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 "Brekke, Jeff" <Je...@qg.com> on 2002/05/13 02:37:37 UTC

RE: Neat Tomcat Integration + proposal for CactusServletTestRunne r

Sounds really interesting.  I've been thinking of different ways to setup
Maven's integration unit testing target to handle not only cactus tests but
other integration unit tests that may not require a servlet container.  This
is a very nice solution to removing the cactus specific stuff from the
project.  Maybe a easy way to allow this would be a small installation jar
and target that a cactus user could use to 'cactus-ify' their installation
of tomcat.

On an aside, it would be interesting if we could find a way to use the ant
build scripts to test our projects directly from cactus without having to
integrate them into our projects build scripts ( or maybe this is now
possible? ).  

=================================================================
Jeffrey D. Brekke                                   Quad/Graphics
Jeff.Brekke@qg.com                              http://www.qg.com


> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@octo.com]
> Sent: Saturday, May 11, 2002 5:27 PM
> To: 'Cactus Users List'
> Subject: Neat Tomcat Integration + proposal for 
> CactusServletTestRunner
> 
> 
> Hi Cactusers !
> 
> If you're working with Tomcat 4.x, here is the best way that I have
> found to integrate Cactus. It is non-intrusive at all for 
> your webapp !
> 
> <tomcat install dir>
>   |_ conf
>     |_ web.xml (add Cactus redirector and mapping as usual)
>   |_ common
>     |_ lib
>       |_ cactus.jar
>       |_ aspectjrt.jar
>       |_ junit.jar
>   |_ webapps
>     |_ mywebapp
>       |_ WEB-INF
>         |_ web.xml (nothing related to Cactus)
>         |_ lib
>           |_ (no cactus jar)
>         |_ classes
>           |_ classes under test
>           |_ cactus test classes
> 
> What this mean is that :
> 
> 1/ Your WAR contain minimal Cactus intrusion (only the test classes)
> 2/ You can "reuse" the Cactus jars and the Cactus redirector 
> mapping for
> all webapps
> 
> What would be real nice now would be that Tomcat bundles the 3 Cactus
> jars and the mapping for redirectors in conf/web.xml, and declare that
> the "recommended" way to unit test servlets,jsps,taglibs,filters is
> Cactus, linking to some Cactus Tomcat Howto tutorial on the Cactus web
> page.
> 
> As a Tomcat user, if you wish to write a unit test for your 
> servlet, you
> would only have to include your test class in your webapp and 
> off you go
> !
> 
> I have just realized that it may be nice to include a
> CactusServletTestRunner (which would be a servlet) as part of 
> the cactus
> jar (in the same way it is done in JunitEE - Hey Kaarle, I now
> understand you ! :-)) so that if you wanted to quickly exercise your
> test you could call that servlet as in :
> 
> http://server:port/mywebapp/CactusServletTestRunner?suite=name
_of_test_c
lass

That would execute the Cactus tests (including beginXXX and endXXX in
the Server JVM) and display the result as HTML or XML (Note: I actually
prefer XML and drop an XSL stylesheet to automatically transform it in
HTML if need be).

Cactus would thus provide 2 solutions to kick start its tests :
- the normal way, i.e. through any existing JUnit Test Runner and thus
through any existing JUnit tool, including IDE JUnit integration plugins
- through the CactusServletTestRunner

Once this is done, I think we have a winner (can't be easier for someone
wanting to write servlet API unit tests !) and can start lobbying the
Tomcat team to bundle Cactus in their distribution.

What do you think ?

Thanks
-Vincent


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Neat Tomcat Integration + proposal for CactusServletTestRunner

Posted by Vincent Massol <vm...@octo.com>.
Jeff,

> -----Original Message-----
> From: Brekke, Jeff [mailto:Jeff.Brekke@qg.com]
> Sent: 13 May 2002 01:38
> To: 'Cactus Users List'
> Subject: RE: Neat Tomcat Integration + proposal for
> CactusServletTestRunner
> 
> Sounds really interesting.  I've been thinking of different ways to
setup
> Maven's integration unit testing target to handle not only cactus
tests
> but
> other integration unit tests that may not require a servlet container.

I can think of 2 solutions :

1/ Maven does not provide any help for the Ant scripts to start the
different containers (i.e. it does not provide them at all). Maven users
have to provide them.

2/ Maven "knows" about Cactus and make it a first class citizen (in the
same way that JUnit is a first class citizen) and provide full support.
It is the easiest for users. The nice thing about the Cactus way of
starting application servers is that it start them in its own directory
and does not modify any file outside of this tmp directory. This is of
course my preferred solution :-)

Another idea is to reuse some cactus scripts and provide some maven
targets maven:start-tomcat-4, etc to automatically start different
servlet containers. This could also be useful outside of Cactus tests.
Until we get that JSR for J2EE deployments ... in about 2 years (that's
the time before all application servers implement it) :-)

In conclusion I would be in favor of having a specific <cactus> or
<cactustest> tag (instead of the "generic" <iutest> one which is not
really generic and I don't think can be as the situation are too
differents).


> This
> is a very nice solution to removing the cactus specific stuff from the
> project.  Maybe a easy way to allow this would be a small installation
jar
> and target that a cactus user could use to 'cactus-ify' their
installation
> of tomcat.

Yes. But an even better way is to have cactus jars be part of the Tomcat
distribution (not sure yet how much lobbying I need to do to get that !
:-)) but I'll try ... I'm currently preparing some nice tutorials and a
nice proposal ...

> 
> On an aside, it would be interesting if we could find a way to use the
ant
> build scripts to test our projects directly from cactus without having
to
> integrate them into our projects build scripts ( or maybe this is now
> possible? ).

I think you lost me ... Can you explain slowly for me ? :-)

Thanks
-Vincent

> 
> =================================================================
> Jeffrey D. Brekke                                   Quad/Graphics
> Jeff.Brekke@qg.com                              http://www.qg.com
> 
> 
> > -----Original Message-----
> > From: Vincent Massol [mailto:vmassol@octo.com]
> > Sent: Saturday, May 11, 2002 5:27 PM
> > To: 'Cactus Users List'
> > Subject: Neat Tomcat Integration + proposal for
> > CactusServletTestRunner
> >
> >
> > Hi Cactusers !
> >
> > If you're working with Tomcat 4.x, here is the best way that I have
> > found to integrate Cactus. It is non-intrusive at all for
> > your webapp !
> >
> > <tomcat install dir>
> >   |_ conf
> >     |_ web.xml (add Cactus redirector and mapping as usual)
> >   |_ common
> >     |_ lib
> >       |_ cactus.jar
> >       |_ aspectjrt.jar
> >       |_ junit.jar
> >   |_ webapps
> >     |_ mywebapp
> >       |_ WEB-INF
> >         |_ web.xml (nothing related to Cactus)
> >         |_ lib
> >           |_ (no cactus jar)
> >         |_ classes
> >           |_ classes under test
> >           |_ cactus test classes
> >
> > What this mean is that :
> >
> > 1/ Your WAR contain minimal Cactus intrusion (only the test classes)
> > 2/ You can "reuse" the Cactus jars and the Cactus redirector
> > mapping for
> > all webapps
> >
> > What would be real nice now would be that Tomcat bundles the 3
Cactus
> > jars and the mapping for redirectors in conf/web.xml, and declare
that
> > the "recommended" way to unit test servlets,jsps,taglibs,filters is
> > Cactus, linking to some Cactus Tomcat Howto tutorial on the Cactus
web
> > page.
> >
> > As a Tomcat user, if you wish to write a unit test for your
> > servlet, you
> > would only have to include your test class in your webapp and
> > off you go
> > !
> >
> > I have just realized that it may be nice to include a
> > CactusServletTestRunner (which would be a servlet) as part of
> > the cactus
> > jar (in the same way it is done in JunitEE - Hey Kaarle, I now
> > understand you ! :-)) so that if you wanted to quickly exercise your
> > test you could call that servlet as in :
> >
> > http://server:port/mywebapp/CactusServletTestRunner?suite=name
> _of_test_c
> lass
> 
> That would execute the Cactus tests (including beginXXX and endXXX in
> the Server JVM) and display the result as HTML or XML (Note: I
actually
> prefer XML and drop an XSL stylesheet to automatically transform it in
> HTML if need be).
> 
> Cactus would thus provide 2 solutions to kick start its tests :
> - the normal way, i.e. through any existing JUnit Test Runner and thus
> through any existing JUnit tool, including IDE JUnit integration
plugins
> - through the CactusServletTestRunner
> 
> Once this is done, I think we have a winner (can't be easier for
someone
> wanting to write servlet API unit tests !) and can start lobbying the
> Tomcat team to bundle Cactus in their distribution.
> 
> What do you think ?
> 
> Thanks
> -Vincent
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>