jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@pivolis.com>
Subject RE: Jetty integration - running individual tests
Date Mon, 10 May 2004 19:04:53 GMT
Hi Chris,

> -----Original Message-----
> From: Chris May [mailto:chris.may@warwick.ac.uk]
> Sent: 10 May 2004 13:06
> To: cactus-user@jakarta.apache.org
> Subject: Jetty integration - running individual tests
> 
> Hi all,
> 
> I'm experimenting with using the Cactus Jetty integration, as per
> http://jakarta.apache.org/cactus/integration/integration_jetty.html,
to
> unit-test JSPs and JSP2 tag files. So far so good - works great, and
> about a hundred times quicker than my previous method of deploying a
> WAR and using HttpUnit. However, I have a some questions:
> 
> The way that the Jetty server is started and stopped is with a custom
> TestSuite (JettyTestSuite) - so I have to make a decision in my code
> about when I want the server started and stopped.

Exactly. That was done on purpose as we wanted to leave you the choice
to run it with any container you may wish. Using a suite allows us 2
things:
- non-intrusiveness WRT the test (kind of an Aspect... ;-))
- ability to have a global setUp()/tearDown() method to start/stop the
server

> I can write a test suite that runs the entire set of JSP tests
> (starting Jetty once when the suite starts), or I can write a suite()
> method on each test class (starting Jetty once per class when I run
all
> of them), or I can write intermediate-sized suites that run some, but
> not all, of my test classes.
> 
> But what I'd like to be able to do is have more dynamic control than
> this. For example,
> 
>   - when I run the full suite and get 1 failure, I'd like to be able
to
> run just that one individual test method without even the rest of it's
> class.
> 
>   - I'd like to not have to remember to add a suite() method to every
> new JSP test class I write, or remember to have to add a reference to
> each new test class to an 'AllJSPTests' class
> 
> - when I run the full test suite I only want Jetty to start up once,
> but I'd still like to be able to run individual classes and have them
> start and stop Jetty for me.
> 
> I suppose that some of this functionality might be in the provided by
> the Eclipse plugin (I'm using 3.0 M8+) so perhaps one way to meet my
> needs  would be for me to help fix that, but I wonder if this is a
> problem that anyone else has experienced and/or worked around, and
that
> might have a solution which is not IDE-specific.

The Eclipse plugin should not be used. It has been decommissioned.

> 
> It seems to me that perhaps it would be possible to write a custom
> extension to TestCase, with a smart setUp/tearDown that could
> start/stop jetty only if necessary. Does that sound like it would
work?

The problem is that I have not found a nice way to do this. There is no
lifecycle hook to do this in JUnit. Or rather, there is one: it's by
providing a TestSetup/TestSuite.

I'd be happy to change the way it works if you can find a solution. 

Then only solution I can think of for now is for you to have a suite()
method in each of your test case classe. Then we could modify the
existing JettyTestSetup class to not start/stop the server if it's
already running. Would that do it for you?

Thanks
-Vincent


Mime
View raw message