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 Andy Kriger <an...@gmail.com> on 2005/01/20 17:43:34 UTC

how to use an existing container

The Ant documentation explains a lot about the Ant tasks created for
Cactus (cactifywar, cactus, runservertests). However, as far as I can
find, it doesn't talk much about using Ant with an existing container
that has been properly configured (for example in Tomcat, placing the
Cactus JARs in the shared/lib and adding the servlets to
conf/web.xml).

After a day or so of messing around with the cactus and runservertests
tasks, I stumbled across a handy hint buried in the mailings lists.
Hopefully this will help other developers starting with Cactus.

Pass the cactus.contextURL property to the JVM running your unit tests
(by your favorite means). See
http://jakarta.apache.org/cactus/integration/manual/howto_config.html#clientside
for more info.

Run your JUnit tests from the standard junit task as you would normally.

That's all there is to it, nothing fancy, but the info is not as easy
to find as it could be. Hope this saves someone out there some time.

-andy

RE: how to use an existing container

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Andy,

Thanks for the suggestion. There's actually a lot to improve on the
documentation. I still think we need a reference section but I agree that
having some use cases would be good too.

If anyone feels like submitting doco patch, please shoot! 

Thanks
-Vincent

> -----Original Message-----
> From: Andy Kriger [mailto:andy.kriger@gmail.com]
> Sent: dimanche 23 janvier 2005 15:57
> To: Cactus Users List
> Subject: Re: how to use an existing container
> 
> I think that the Manual Cactus Integration page is not explicit enough
> regarding running in-container test on an container that is not
> configured by Cactus. The Tomcat Quickstart gives an example test and
> runs the test using the browser method. The brief command-line example
> demonstrates running tests with TestRunner. The Ant examples all use
> the Cactus ant tasks (and state that runservertests calls a JUnit
> task).
> 
> Looking back over the Cactus site, all the information is there but in
> separated parts that you need to pull together to realize it. I guess
> I didn't make the connection that to run tests using Ant, you can use
> the JUnit task (if the container is configured properly) and that the
> runservertests task is really a wrapper that starts/stops the
> container and runs that JUnit target in the middle.
> 
> If I had any suggestion to make out of all this, it would be to
> reorganize some of the Running Tests docs along the lines of use cases
> instead of laying out all of the available options (which can be
> overwhelming to a new user who just wants to get up and running
> without knowing the full details of how it works under-the-hood or
> what all the available options are)...
> 
> 1) Running tests in an existing already-configred container
> * How to configure the container (combine the server-side
> config/classpath pages and link to container-specific pages like
> Tomcat, Jetty, etc)
> * How to configure the client (combine the client-side config/classpath
> pages)
> * How to run tests
> ** JUnit TestRunner examples
> ** Ant example with a JUnit task
> ** Browser examples (with and without XSLT)
> 
> 2) Running tests in a container managed by Cactus
> * cactifywar
> * cactus example
> * runservertests
> * webxmlmerge
> 
> 3) Running tests in an IDE
> * Eclipse
> * etc etc
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org




Re: how to use an existing container

Posted by Andy Kriger <an...@gmail.com>.
I think that the Manual Cactus Integration page is not explicit enough
regarding running in-container test on an container that is not
configured by Cactus. The Tomcat Quickstart gives an example test and
runs the test using the browser method. The brief command-line example
demonstrates running tests with TestRunner. The Ant examples all use
the Cactus ant tasks (and state that runservertests calls a JUnit
task).

Looking back over the Cactus site, all the information is there but in
separated parts that you need to pull together to realize it. I guess
I didn't make the connection that to run tests using Ant, you can use
the JUnit task (if the container is configured properly) and that the
runservertests task is really a wrapper that starts/stops the
container and runs that JUnit target in the middle.

If I had any suggestion to make out of all this, it would be to
reorganize some of the Running Tests docs along the lines of use cases
instead of laying out all of the available options (which can be
overwhelming to a new user who just wants to get up and running
without knowing the full details of how it works under-the-hood or
what all the available options are)...

1) Running tests in an existing already-configred container
* How to configure the container (combine the server-side
config/classpath pages and link to container-specific pages like
Tomcat, Jetty, etc)
* How to configure the client (combine the client-side config/classpath pages)
* How to run tests
** JUnit TestRunner examples
** Ant example with a JUnit task
** Browser examples (with and without XSLT)

2) Running tests in a container managed by Cactus
* cactifywar
* cactus example
* runservertests
* webxmlmerge

3) Running tests in an IDE
* Eclipse
* etc etc

RE: how to use an existing container

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Andy,

> -----Original Message-----
> From: Andy Kriger [mailto:andy.kriger@gmail.com]
> Sent: jeudi 20 janvier 2005 17:44
> To: Cactus Users List
> Subject: how to use an existing container
> 
> The Ant documentation explains a lot about the Ant tasks created for
> Cactus (cactifywar, cactus, runservertests). However, as far as I can
> find, it doesn't talk much about using Ant with an existing container
> that has been properly configured (for example in Tomcat, placing the
> Cactus JARs in the shared/lib and adding the servlets to
> conf/web.xml).

Yes. I think the reason it doesn't mention this yet is because it's your
choice as a user of Tomcat, WebLogic, etc to configure them the way you
wish. But maybe you mean something else. In any case, I'm all for improving
the doc and if someone submits a doco patch, I'll happily check it in.

> 
> After a day or so of messing around with the cactus and runservertests
> tasks, I stumbled across a handy hint buried in the mailings lists.
> Hopefully this will help other developers starting with Cactus.
> 
> Pass the cactus.contextURL property to the JVM running your unit tests
> (by your favorite means). See
> http://jakarta.apache.org/cactus/integration/manual/howto_config.html#clie
> ntside
> for more info.
> 
> Run your JUnit tests from the standard junit task as you would normally.
> 
> That's all there is to it, nothing fancy, but the info is not as easy
> to find as it could be. Hope this saves someone out there some time.

The way it is currently organized is that all the manners to run Cactus
tests are described on one page:
http://jakarta.apache.org/cactus/integration/index.html

The tip you mention seems to correspond to one way of running Cactus tests
which is the "manual" way (i.e. you take care of configuring Cactus
yourself).

I'd like to pinpoint where on your reading path you've stumbled. I think
I've seen a JIRA issue that you've opened that says that the runservertests
task documentation does not mention the cactus properties. Good catch! We'll
need to patch this. Do you think you could provide a documentation patch?

I've just reviewed the <runservertests> and <cactus> tasks and it appears
that the cactus.contextURL property is set in the <cactus> task but not in
the <runservertests> one. This is normal as the <cactus> task has the port
and context defined but this is not the case for the <runservertests> task. 

Thanks Andy!
-Vincent