You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Erez Nahir <en...@cisco.com> on 2004/01/15 13:36:18 UTC

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).
In my web.xml file I added:
<servlet>
<servlet-name>CactusServletTestRunner</servlet-name>
<servlet-class>org.apache.cactus.server.runner.ServletTestRunner</servlet-cl
ass>
</servlet>
<servlet-mapping>
<servlet-name>CactusServletTestRunner</servlet-name>
<url-pattern>/CactusServletTestRunner</url-pattern>
</servlet-mapping>
 
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.

RE: Using cactus with junit tests and ant on existing and running container.

Posted by Simon Gibbs <en...@simongibbs.co.uk>.
Hi Erez, I have been following this thread as I have had similar issues,
so I will see if I can make some useful suggestions.

On Thu, 2004-01-15 at 16:05, Erez Nahir wrote:
> > Oh ok. I thought you wanted to automate the whole process. 

> I do want very much but it's a very complicated project developed over 6
> remote sites and its 3rd release so we cant get it all in one, for now I can
> only try to automate the test itself :-(.

I'm surprised this is relevant. Are you not using CVS? You should be
able to build and run from anywhere with equal ease. Also you should
really have a dev server for your project and not be constrained by
using a shared server instance. I'm guessing you have encountered office
politics :-)

> > Simply use the <junit> task as you've done.
> But than it doesn't started in the Tomcat VM but in my VM isn't it?

That is entirely true. The point is that many of your tests may not need
to run inside the Tomcat JVM. Cactus is not needed for that type of
test.

> The NCDFE is really not relevant here IMHO.

I agree it looks like the NCDFE is caused by the tests running outside
the Tomcat JVM when you need them to be on the inside. I got this too.

> The process as it is done today is as follows:
> 1. Build generate the project image;
> 2. Build generate project-test image;
> 3. Developers install the project.
> 4. Developers install the project-test (now all the Cactus specific stuff is
> added but we can live with it because we run also external tests on project
> image without project-test install);

This is fine, but you can automate 3 and 4. I ended up using the <get>
task to call the Tomcat manager and trigger the reloading of my wars.
BTW I would try to use a WAR, the unpacked-war format is a tomcat
feature - not part of the standard.

The app manager documentation is here:
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html I'm
not sure if its available on 3.0 though  <shrug>.

> 5. Developers open a browser and use index.html with the links.
> 6. Upon clicking on specific link, the relevant test case is started and
> generate the known junit report (but only for this test).
> 
> Now, what I'm looking for is to improve steps number 5 and 6 (in addition I
> can add stuff to step 4), such that I'll be able to run either a single url
> call that will generate the xmls (and than I'll generate the report with
> <junitreport> ant's task), or do ant call with cactus to run all the test
> cases as if they are on the real VM.
> 

There are a couple of ways to improve this. First would be to simply use 
<get> to trigger all the tests from the build file and download the 
results as you want them. Alternatively you can bundle the tests together 
into a TestSuite which can then be invoked in one step either from the 
browser or Ant.

Good luck

-- 
Simon Gibbs <en...@simongibbs.co.uk>
http://www.simongibbs.co.uk
07866 741 461 / 33 / BA15 1TB


RE: Using cactus with junit tests and ant on existing and running container.

Posted by Vincent Massol <vm...@pivolis.com>.
Sorry Erez, but I'm a bit rushed by the time and you keep changing the
subject/questions in your emails (at least that's my perception) and I
don't understand what your problem is. I don't know what your question
is at this point? I've also suggested several solutions (including using
<junit> directly as you seem to have done - this is at least the script
you were showing before).

I'll let others chime in for now.

Thanks
-Vincent

> -----Original Message-----
> From: Erez Nahir [mailto:enahir@cisco.com]
> Sent: 15 January 2004 17:06
> To: 'Cactus Users List'
> Subject: RE: Using cactus with junit tests and ant on existing and
running
> container.
> 
> > Oh ok. I thought you wanted to automate the whole process.
> > Any reason you don't want? The not-so-nice-thing with your
> > setup/approach is that you're going to be "polluting" your
> > runtime application with Cactus-specific stuff (jars in lib/,
> > extra config in web.xml, etc).
> 
> I do want very much but it's a very complicated project developed over
6
> remote sites and its 3rd release so we cant get it all in one, for now
I
> can
> only try to automate the test itself :-(.
> 
> >
> > Simply use the <junit> task as you've done.
> But than it doesn't started in the Tomcat VM but in my VM isn't it?
> >
> > Now, if you would like us to help you, youneed to show us
> > what your problem is. You just mention in your email that you
> > get a NCDFE. Can you show the stack trace?
> 
> Sure, but that's not the real problem, this one I solve by adding the
> required jars to my project's build classpath, so I did and it solved
the
> problem.
> I have another tool someone in my team wrote, that is calling the
> CactusServletTestRunner with every testcase, but this in not
acceptable
> cause each one need to go over all the links (we have more than 50).
> 
> What I want is to be able to call all my test cases from ant file (or
even
> with a single URL) and Cactus to invoke all the tests on tomcat's VM.
> 
> The NCDFE is really not relevant here IMHO.
> 
> The process as it is done today is as follows:
> 1. Build generate the project image;
> 2. Build generate project-test image;
> 3. Developers install the project.
> 4. Developers install the project-test (now all the Cactus specific
stuff
> is
> added but we can live with it because we run also external tests on
> project
> image without project-test install);
> 5. Developers open a browser and use index.html with the links.
> 6. Upon clicking on specific link, the relevant test case is started
and
> generate the known junit report (but only for this test).
> 
> Now, what I'm looking for is to improve steps number 5 and 6 (in
addition
> I
> can add stuff to step 4), such that I'll be able to run either a
single
> url
> call that will generate the xmls (and than I'll generate the report
with
> <junitreport> ant's task), or do ant call with cactus to run all the
test
> cases as if they are on the real VM.
> 
> Any suggestions how to do it?
> Thanks,
> Erez.
> >
> > Thanks
> > -Vincent
> >
> > > Thanks,
> > > Erez.
> > >
> > > > -----Original Message-----
> > > > From: Vincent Massol [mailto:vmassol@pivolis.com]
> > > > Sent: Thursday, January 15, 2004 4:59 PM
> > > > To: 'Cactus Users List'
> > > > Subject: RE: Using cactus with junit tests and ant on
> > existing and
> > > > running container.
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Erez Nahir [mailto:enahir@cisco.com]
> > > > > Sent: 15 January 2004 14:54
> > > > > To: 'Cactus Users List'
> > > > > Subject: RE: Using cactus with junit tests and ant on
> > existing and
> > > > running
> > > > > container.
> > > > >
> > > > > Well, have gone again over the link and emails, added some
> > > > jars to the
> > > > > build.xml.
> > > > >
> > > > > Now I can run the tests but I'm still thinking it's not in
> > > > tomcat's VM
> > > > but
> > > > > on my VM (the one ant forks via the junit).
> > > > >
> > > > > In addition, some other details:
> > > > > 1. Not all the jars used by my application are under
> > the project's
> > > > > context, some under tomcat's lib (so I added them to
> > the build.xml
> > > > > file).
> > > > > 2. Tomcat is running as NT Service.
> > > > >
> > > > > If you can give me a hint it will be great, cause I don't
> > > > see were is
> > > > my
> > > > > mistake.
> > > >
> > > > Are you using the <cactus> task as mentioned in my email?
> > > > It's described at the link I gave you.
> > > >
> > > > [snip]
> > > >
> > > > Thanks
> > > > -Vincent
> > > >
> > > >
> > > >
> >
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
cactus-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > cactus-user-help@jakarta.apache.org
> > > >
> > >
> > >
> > >
> >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
cactus-user-help@jakarta.apache.org
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



RE: Using cactus with junit tests and ant on existing and running container.

Posted by Erez Nahir <en...@cisco.com>.
> Oh ok. I thought you wanted to automate the whole process. 
> Any reason you don't want? The not-so-nice-thing with your 
> setup/approach is that you're going to be "polluting" your 
> runtime application with Cactus-specific stuff (jars in lib/, 
> extra config in web.xml, etc).

I do want very much but it's a very complicated project developed over 6
remote sites and its 3rd release so we cant get it all in one, for now I can
only try to automate the test itself :-(.

> 
> Simply use the <junit> task as you've done.
But than it doesn't started in the Tomcat VM but in my VM isn't it?
> 
> Now, if you would like us to help you, youneed to show us 
> what your problem is. You just mention in your email that you 
> get a NCDFE. Can you show the stack trace?

Sure, but that's not the real problem, this one I solve by adding the
required jars to my project's build classpath, so I did and it solved the
problem.
I have another tool someone in my team wrote, that is calling the
CactusServletTestRunner with every testcase, but this in not acceptable
cause each one need to go over all the links (we have more than 50).

What I want is to be able to call all my test cases from ant file (or even
with a single URL) and Cactus to invoke all the tests on tomcat's VM.

The NCDFE is really not relevant here IMHO.

The process as it is done today is as follows:
1. Build generate the project image;
2. Build generate project-test image;
3. Developers install the project.
4. Developers install the project-test (now all the Cactus specific stuff is
added but we can live with it because we run also external tests on project
image without project-test install);
5. Developers open a browser and use index.html with the links.
6. Upon clicking on specific link, the relevant test case is started and
generate the known junit report (but only for this test).

Now, what I'm looking for is to improve steps number 5 and 6 (in addition I
can add stuff to step 4), such that I'll be able to run either a single url
call that will generate the xmls (and than I'll generate the report with
<junitreport> ant's task), or do ant call with cactus to run all the test
cases as if they are on the real VM.

Any suggestions how to do it?
Thanks,
Erez.
> 
> Thanks
> -Vincent
> 
> > Thanks,
> > Erez.
> > 
> > > -----Original Message-----
> > > From: Vincent Massol [mailto:vmassol@pivolis.com]
> > > Sent: Thursday, January 15, 2004 4:59 PM
> > > To: 'Cactus Users List'
> > > Subject: RE: Using cactus with junit tests and ant on 
> existing and 
> > > running container.
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Erez Nahir [mailto:enahir@cisco.com]
> > > > Sent: 15 January 2004 14:54
> > > > To: 'Cactus Users List'
> > > > Subject: RE: Using cactus with junit tests and ant on 
> existing and
> > > running
> > > > container.
> > > >
> > > > Well, have gone again over the link and emails, added some
> > > jars to the
> > > > build.xml.
> > > >
> > > > Now I can run the tests but I'm still thinking it's not in
> > > tomcat's VM
> > > but
> > > > on my VM (the one ant forks via the junit).
> > > >
> > > > In addition, some other details:
> > > > 1. Not all the jars used by my application are under 
> the project's 
> > > > context, some under tomcat's lib (so I added them to 
> the build.xml 
> > > > file).
> > > > 2. Tomcat is running as NT Service.
> > > >
> > > > If you can give me a hint it will be great, cause I don't
> > > see were is
> > > my
> > > > mistake.
> > >
> > > Are you using the <cactus> task as mentioned in my email?
> > > It's described at the link I gave you.
> > >
> > > [snip]
> > >
> > > Thanks
> > > -Vincent
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> cactus-user-help@jakarta.apache.org
> > >
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> 


RE: Using cactus with junit tests and ant on existing and running container.

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Erez Nahir [mailto:enahir@cisco.com]
> Sent: 15 January 2004 16:36
> To: 'Cactus Users List'
> Subject: RE: Using cactus with junit tests and ant on existing and
running
> container.
> 
> I don't use <cactus> because I don't have war file (or ear file) so I
> can't
> have this property in the task.
> When I start the tests, the application is already installed and it
has
> directory structure extracted, it look like:
> TOMCAT_HOME\vms\athena (which is the context root)
> Under athena I have: WEB-INF (with lib, classes, util and other
> directories). Also under athena I have more directories used by my
> application.

Oh ok. I thought you wanted to automate the whole process. Any reason
you don't want? The not-so-nice-thing with your setup/approach is that
you're going to be "polluting" your runtime application with
Cactus-specific stuff (jars in lib/, extra config in web.xml, etc).

> 
> Is it possible to use <cactus> without war and without <cactifywar>
called
> before? Docs says: no.

no :-)

Simply use the <junit> task as you've done.

Now, if you would like us to help you, youneed to show us what your
problem is. You just mention in your email that you get a NCDFE. Can you
show the stack trace?

Thanks
-Vincent

> Thanks,
> Erez.
> 
> > -----Original Message-----
> > From: Vincent Massol [mailto:vmassol@pivolis.com]
> > Sent: Thursday, January 15, 2004 4:59 PM
> > To: 'Cactus Users List'
> > Subject: RE: Using cactus with junit tests and ant on
> > existing and running container.
> >
> >
> >
> > > -----Original Message-----
> > > From: Erez Nahir [mailto:enahir@cisco.com]
> > > Sent: 15 January 2004 14:54
> > > To: 'Cactus Users List'
> > > Subject: RE: Using cactus with junit tests and ant on existing and
> > running
> > > container.
> > >
> > > Well, have gone again over the link and emails, added some
> > jars to the
> > > build.xml.
> > >
> > > Now I can run the tests but I'm still thinking it's not in
> > tomcat's VM
> > but
> > > on my VM (the one ant forks via the junit).
> > >
> > > In addition, some other details:
> > > 1. Not all the jars used by my application are under the project's
> > > context, some under tomcat's lib (so I added them to the build.xml
> > > file).
> > > 2. Tomcat is running as NT Service.
> > >
> > > If you can give me a hint it will be great, cause I don't
> > see were is
> > my
> > > mistake.
> >
> > Are you using the <cactus> task as mentioned in my email?
> > It's described at the link I gave you.
> >
> > [snip]
> >
> > Thanks
> > -Vincent
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



RE: Using cactus with junit tests and ant on existing and running container.

Posted by Erez Nahir <en...@cisco.com>.
I don't use <cactus> because I don't have war file (or ear file) so I can't
have this property in the task.
When I start the tests, the application is already installed and it has
directory structure extracted, it look like:
TOMCAT_HOME\vms\athena (which is the context root)
Under athena I have: WEB-INF (with lib, classes, util and other
directories). Also under athena I have more directories used by my
application.

Is it possible to use <cactus> without war and without <cactifywar> called
before? Docs says: no.
Thanks,
Erez. 

> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@pivolis.com] 
> Sent: Thursday, January 15, 2004 4:59 PM
> To: 'Cactus Users List'
> Subject: RE: Using cactus with junit tests and ant on 
> existing and running container.
> 
> 
> 
> > -----Original Message-----
> > From: Erez Nahir [mailto:enahir@cisco.com]
> > Sent: 15 January 2004 14:54
> > To: 'Cactus Users List'
> > Subject: RE: Using cactus with junit tests and ant on existing and
> running
> > container.
> > 
> > Well, have gone again over the link and emails, added some 
> jars to the 
> > build.xml.
> > 
> > Now I can run the tests but I'm still thinking it's not in 
> tomcat's VM
> but
> > on my VM (the one ant forks via the junit).
> > 
> > In addition, some other details:
> > 1. Not all the jars used by my application are under the project's 
> > context, some under tomcat's lib (so I added them to the build.xml 
> > file).
> > 2. Tomcat is running as NT Service.
> > 
> > If you can give me a hint it will be great, cause I don't 
> see were is
> my
> > mistake.
> 
> Are you using the <cactus> task as mentioned in my email? 
> It's described at the link I gave you.
> 
> [snip]
> 
> Thanks
> -Vincent
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> 


RE: Using cactus with junit tests and ant on existing and running container.

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Erez Nahir [mailto:enahir@cisco.com]
> Sent: 15 January 2004 14:54
> To: 'Cactus Users List'
> Subject: RE: Using cactus with junit tests and ant on existing and
running
> container.
> 
> Well, have gone again over the link and emails, added some jars to the
> build.xml.
> 
> Now I can run the tests but I'm still thinking it's not in tomcat's VM
but
> on my VM (the one ant forks via the junit).
> 
> In addition, some other details:
> 1. Not all the jars used by my application are under the project's
> context,
> some under tomcat's lib (so I added them to the build.xml file).
> 2. Tomcat is running as NT Service.
> 
> If you can give me a hint it will be great, cause I don't see were is
my
> mistake.

Are you using the <cactus> task as mentioned in my email? It's described
at the link I gave you.

[snip]

Thanks
-Vincent


RE: Using cactus with junit tests and ant on existing and running container.

Posted by Erez Nahir <en...@cisco.com>.
Well, have gone again over the link and emails, added some jars to the
build.xml.

Now I can run the tests but I'm still thinking it's not in tomcat's VM but
on my VM (the one ant forks via the junit).

In addition, some other details:
1. Not all the jars used by my application are under the project's context,
some under tomcat's lib (so I added them to the build.xml file).
2. Tomcat is running as NT Service.

If you can give me a hint it will be great, cause I don't see were is my
mistake.

Thanks again,
Erez. 

> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@pivolis.com] 
> Sent: Thursday, January 15, 2004 3:13 PM
> To: 'Cactus Users List'
> Subject: RE: Using cactus with junit tests and ant on 
> existing and running container.
> 
> 
> 
> > -----Original Message-----
> > From: Erez Nahir [mailto:enahir@cisco.com]
> > Sent: 15 January 2004 14:01
> > To: 'Vincent Massol'; 'Cactus Users List'
> > Subject: RE: Using cactus with junit tests and ant on existing and
> running
> > container.
> > 
> > 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.
> 
> Yes, you are! Please read my email and the link I gave you :-)
> 
> Thanks
> -Vincent
> 
> > 
> > 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.
> > >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> 


RE: Using cactus with junit tests and ant on existing and running container.

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Erez Nahir [mailto:enahir@cisco.com]
> Sent: 15 January 2004 14:01
> To: 'Vincent Massol'; 'Cactus Users List'
> Subject: RE: Using cactus with junit tests and ant on existing and
running
> container.
> 
> 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.

Yes, you are! Please read my email and the link I gave you :-)

Thanks
-Vincent

> 
> 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.
> >



RE: Using cactus with junit tests and ant on existing and running container.

Posted by Erez Nahir <en...@cisco.com>.
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.
> 


RE: Using cactus with junit tests and ant on existing and running container.

Posted by Vincent Massol <vm...@pivolis.com>.
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.ServletTestRunner</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.