jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <cml...@gmx.de>
Subject Re: Running tests with StrutsTestCase, actionPerform() does not work
Date Fri, 22 Aug 2003 09:01:51 GMT
Arndt Pohlmann wrote:

> Hi!
> 
> I've set up a testing environment for an existing Webapplication which uses
> Struts 1.1, with Cactus 13-1.5beta1 and StrutsTestCase 200-1.1_2.2

Hmm, this looks like a mismatch. You're using Cactus for J2EE version 
1.3, but StrutsTestCase for Servlet-API version 2.2 (which corresponds 
to J2EE version 1.2). You should either use StrutsTestCase 200-1.1_2.3 
or Cactus 12.

> I add the test classes during ant build via "CactifyWar"-task, and then use
> runservertests and junit-tasks for running the tests.
> 
> But my problem is, that my test methods work, but do not execute the
> "execute()"-methods of my Action classes. It does something (JBoss tells me
> something about PropertyMessageResources initializing, and TilesPlugin
> factory and so on, but no logging msgs from my execute method...
> 
> I've already posted in StutsTestCase-forum, but it is less frequented than
> this mailing list, and I really have to get this going (this is a project
> for my last exam...)
> 
> Here's my cactify war task:
> 
> <target name="cactify war" depends="buildwar" description="Adds cactus
> resources to WAR" >
>         <delete file="${build.dir}/aproda3.war" />
>         <copy todir="${build.dir}" file="${dist.dir}/aproda3.war" />
>         <delete file="${dist.dir}/aproda3.war" />
>         <cactifywar srcfile="${build.dir}/aproda3.war" destfile="
> ${dist.dir}/aproda3.war">
>             <lib file="${lib.dir}/strutstest.jar" />
>         </cactifywar>
>     </target>

Does the WAR contain your test case classes before the cactification? 
Otherwise you'll need to add them like this:

           <cactifywar ...>
             <classes dir="path/to/test/classes"/>

           </cactifywar>

> Here's my testing-task (conatiner.start and container.stop are empty, since
> the war gets deployed elsewhere):
> 
>  <target name="Run Tests" description="Runs the Cactus Tests">
>         <delete dir="${reports.dir}" />
>         <mkdir dir="${reports.dir}" />
>         <runservertests
>             testurl
> ="http://localhost:8080/ServletRedirector?Cactus_Service=RUN_TEST"
>             starttarget="container.start"
>             stoptarget="container.stop"
>             testtarget="test"/>
>     </target>
> 
> <target name="test">
>         <junit fork="yes">
>             <formatter type="plain" usefile="false" />
>             <classpath refid="test.classpath" />
>             <batchtest>
>                 <fileset dir="${classes.dir}">
>                     <include name="**/Test*.class"/>
>                     <exclude name="**/TestAll.class"/>
>                 </fileset>
>             </batchtest>
>         </junit>
>     </target>
> 
> 
> Any suggestions are more than welcome!

What happens when you run the JUnit task like this?

> Thanks,
> 
> Arndt

-- 
Christopher Lenz
/=/ cmlenz at gmx.de


Mime
View raw message