2007/6/1, Dheerendra Kulkarni <[EMAIL PROTECTED]>:
Hi,
I am trying to run the testcase from Ant,

My Ant file is as follows



....

<target name="Cactus-Test" description="Run Cactus tests"
depends="compile">

            <war destfile="${bin}/EWSTests.war" webxml="${src}/web.xml">

                  <classes dir="${bin}" />

            </war>

            <cactifywar srcfile="${bin}/EWSTests.war" destfile=
"${bin}/CactifiedEWSTests.war" >

                  <lib file="C:/dev/pws/lib/cactus.jar" />

            </cactifywar>

            <cactus warfile="${bin}/CactifiedEWSTests.war" printsummary=
"yes" failureproperty="tests.failed" showoutput="yes">

                  <containerset>

                        <tomcat4x dir="c:/tomcat" port="8000" todir=
"c:/tomcat/reports"/>

                  </containerset>

                  <test name="TestCases.TestSampleServlet" outfile="
cactus.output">

                        <formatter type="plain" />

                  </test>

            </cactus>

            <delete file="CactifiedEWSTests.war" />

      </target>

....




 I am pasting the Ant output here

Cactus-Test:
[war] Building war: C:\dev\EasyEWS\EWSTestAutomation\bin\EWSTests.war
[cactifywar] Analyzing war:
C:\dev\EasyEWS\EWSTestAutomation\bin\EWSTests.war
[cactifywar] Could not copy the JSP redirector (Resource
'/org/apache/cactus/server/jspRedirector.jsp' not found)
[cactifywar] Building war:
C:\dev\EasyEWS\EWSTestAutomation\bin\CactifiedEWSTests.war
[cactifywar] Warning: selected war files include a WEB-INF/web.xml which
will be ignored (please use webxml attribute to war task)

[cactus] -----------------------------------------------------------------
[cactus] Running tests against Tomcat 4.1.24 @ http://localhost:8000
[cactus] -----------------------------------------------------------------

[cactus] Deleting 14 files from
C:\DOCUME~1\DKULKA~1\LOCALS~1\Temp\cactus\tomcat4x
[cactus] Deleted 12 directories from
C:\DOCUME~1\DKULKA~1\LOCALS~1\Temp\cactus\tomcat4x
[cactus] HttpConnector Opening server socket on all host IP addresses
[cactus] Starting service Tomcat-Standalone
[cactus] Apache Tomcat/4.1.24
[cactus] HostConfig[localhost]: Expanding web application archive
CactifiedEWSTests.war
[cactus] StandardHost[localhost]: Installing web application at context
path
/CactifiedEWSTests from URL

file:C:/DOCUME~1/DKULKA~1/LOCALS~1/Temp/cactus/tomcat4x/webapps/CactifiedEWSTests
[cactus] WebappLoader[/CactifiedEWSTests]: Deploying class repositories to
work directory C:\Documents and Settings\dkulkarni\Local
Settings\Temp\cactus\tomcat4x\work\Standalone\localhost\CactifiedEWSTests
[cactus] WebappLoader[/CactifiedEWSTests]: Deploy class files
/WEB-INF/classes to

C:\DOCUME~1\DKULKA~1\LOCALS~1\Temp\cactus\tomcat4x\webapps\CactifiedEWSTests\WEB-INF\classes
[cactus] WebappLoader[/CactifiedEWSTests]: Deploy JAR
/WEB-INF/lib/aspectjrt.jar to

C:\DOCUME~1\DKULKA~1\LOCALS~1\Temp\cactus\tomcat4x\webapps\CactifiedEWSTests\WEB-INF\lib\aspectjrt.jar
[cactus] WebappLoader[/CactifiedEWSTests]: Deploy JAR
/WEB-INF/lib/cactus.jar to

C:\DOCUME~1\DKULKA~1\LOCALS~1\Temp\cactus\tomcat4x\webapps\CactifiedEWSTests\WEB-INF\lib\cactus.jar
[cactus] WebappLoader[/CactifiedEWSTests]: Deploy JAR
/WEB-INF/lib/commons-
httpclient.jar to

C:\DOCUME~1\DKULKA~1\LOCALS~1\Temp\cactus\tomcat4x\webapps\CactifiedEWSTests\WEB-INF\lib\commons-
httpclient.jar
[cactus] WebappLoader[/CactifiedEWSTests]: Deploy JAR
/WEB-INF/lib/commons-
logging.jar to

C:\DOCUME~1\DKULKA~1\LOCALS~1\Temp\cactus\tomcat4x\webapps\CactifiedEWSTests\WEB-INF\lib\commons-
logging.jar
[cactus] WebappLoader[/CactifiedEWSTests]: Deploy JAR
/WEB-INF/lib/junit.jar
to

C:\DOCUME~1\DKULKA~1\LOCALS~1\Temp\cactus\tomcat4x\webapps\CactifiedEWSTests\WEB-INF\lib\junit.jar
[cactus] StandardManager[/CactifiedEWSTests]: Seeding random number
generator class java.security.SecureRandom
[cactus] StandardManager[/CactifiedEWSTests]: Seeding of random number
generator has been completed
[cactus] StandardWrapper[/CactifiedEWSTests:default]: Loading container
servlet default
[cactus] StandardWrapper[/CactifiedEWSTests:invoker]: Loading container
servlet invoker
[cactus] HttpConnector[8000] Starting background thread
[cactus] Running TestCases.TestSampleServlet
[cactus] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[cactus] Test TestCases.TestSampleServlet FAILED
[cactus] Stopping service Tomcat-Standalone
[cactus] HttpConnector[8000] Stopping background thread
[cactus] StandardHost[localhost]: Removing web application at context path
/CactifiedEWSTests

BUILD SUCCESSFUL

And the c:/tomcat/reports/ cactus.output.txt has the following


Testsuite: TestCases.TestSampleServlet
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

 Caused an ERROR
TestCases.TestSampleServlet
java.lang.ClassNotFoundException: TestCases.TestSampleServlet
 at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:141)
 at org.apache.cactus.integration.ant.CactusTask.executeInContainer(
CactusTask.java:458)
 at org.apache.cactus.integration.ant.CactusTask.execute(CactusTask.java
:208)


Could some one help me finding out what the problem copuld be


regards
Dheerendra


Hi Dheerenda,

I would guess that your war file wasn't cactified correctly.
Just make sure the content of your war is correct, and if it isn't
you can try and include the test-classes with:
 <classes dir="${build.dir}/classes/test" includes="**/*.class"/>
as in

http://jakarta.apache.org/cactus/integration/ant/task_cactifywar.html

Hope that helps.

--
Regards, Petar!
Karlovo, Bulgaria.

Bulgarian medics in Libya are innocent!
http://www.nestesami.bg/main/index.php

Public PGP Key at:
https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Reply via email to