jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erez Nahir" <ena...@cisco.com>
Subject RE: Using cactus with junit tests and ant on existing and running container.
Date Thu, 15 Jan 2004 13:01:25 GMT
Hi Vincent,

Yes I did go over all documents and mails, but when I'm running my tests I
get some NoClassDefFoundError exceptions which shouldn't occur. This leads
me to the thought that the tests are not actually running in Tomcat's VM but
in the VM of ant.

Here is some parts of my build.xml (its still pretty messy cause it's a work
in progress :-(.

<taskdef resource="cactus.tasks" classpathref="cactus.classpath"/>

<target name="test" description="Run JUnit test cases of Athena componenst">
	<runservertests
 
testurl="http://enahir-w2k:1751/athena/CactusServletTestRunner?suite=com.cis
co.nm.vms.common.AthenaTest"
    starttarget="start.tomcat"
    stoptarget="stop.tomcat"
    testtarget="testme"/>

</target>

<target name="start.tomcat">

</target>

<target name="stop.tomcat">

</target>

<target name="testme">
	<mkdir dir="${test.output}"/>
	<junit printsummary="${junit.summary}" 
			haltonfailure="${junit.halt.onfailure}"
			haltonerror="${junit.halt.onerror}"
			filtertrace="${junit.filtertrace}"
			fork="${junit.fork}">


				<classpath >
	<path refid="project.classpath"/>
	
	<pathelement location="${aspectjrt.jar}"/>
	<pathelement location="${cactus.jar}"/>
	<pathelement location="${cactus.ant.jar}"/>
	<pathelement location="${commons.httpclient.jar}"/>
	<pathelement location="${commons.logging.jar}"/>
	<pathelement location="${junit.jar}"/>
			</classpath>
			<formatter type="xml"/>

		<batchtest fork="${junit.fork}" todir="${test.output}">
			<fileset dir="${athena.root.dir}/WEB-INF/classes">
				<include name="**/*Test*"/>
				<!-- helper classes, not testcases -->
				<exclude name="**/*Util*"/>
				<exclude name="**/*Factory*"/>
				<exclude name="**/*Base*"/>
			</fileset>
		</batchtest>
		</junit>
</target>

I guess I'm missing something.

Thanks,
Erez. 

> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@pivolis.com] 
> Sent: Thursday, January 15, 2004 2:50 PM
> To: 'Cactus Users List'
> Cc: enahir@cisco.com
> Subject: RE: Using cactus with junit tests and ant on 
> existing and running container.
> 
> Hi Erez,
> 
> > -----Original Message-----
> > From: Erez Nahir [mailto:enahir@cisco.com]
> > Sent: 15 January 2004 13:36
> > To: cactus-user@jakarta.apache.org
> > Cc: 'Erez Nahir'
> > Subject: Using cactus with junit tests and ant on existing 
> and running 
> > container.
> > 
> > Hi,
> > 
> > On our project we have a running tomcat3.x that is used by 
> our project
> as
> > well as others.
> > My requirement it to be able to run junit test cases (which 
> I run now
> with
> > ant and junit) inside tomcat's VM.
> > 
> > Can someone please share info how should I create the ant file to do
> such
> > thing (I got the impression I can do it with Cactus).
> 
> Good impression! Have you had a look at the web site?
> 
> http://jakarta.apache.org/cactus/integration/ant/index.html
> 
> 
> > In my web.xml file I added:
> > <servlet>
> > <servlet-name>CactusServletTestRunner</servlet-name>
> >
> <servlet-class>org.apache.cactus.server.runner.ServletTestRunn
> er</servle
> t-
> > cl
> > ass>
> > </servlet>
> > <servlet-mapping>
> > <servlet-name>CactusServletTestRunner</servlet-name>
> > <url-pattern>/CactusServletTestRunner</url-pattern>
> > </servlet-mapping>
> 
> Forget this. It's not needed if you use the <cactus> task. In 
> addition, it's not correct :-)
> 
> > 
> > I also tried with runservertests calling junit task in the 
> test target
> and
> > with cactus task too. The problem is I don't have 
> project.war file, I 
> > already got all the project directories and files extracted into
> tomcat's
> > directory (which is not the default).
> > 
> > Thanks,
> > Erez.
> 
> -Vincent
> 
> PS: Please do subscribe to the mailing list. I've moderated 
> your message this time.
> 


Mime
View raw message