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 Jason Novotny <no...@aei.mpg.de> on 2003/04/01 10:11:42 UTC

writing a test suite

Hi,

What is the easiest way to write a test suite for a particulaar web 
application containing a single servlet. With Junit before I would 
create a test suite that I could add individual tests in like so:

TestSuite suite = new TestSuite();
        suite.addTest(new TestSuite(TestOne.class));
        suite.addTest(new TestSuite(TestTwo.class));
    ...

    Basically do I have to do a "SampleServlet sample = new 
SampleServlet()" in every testXXX method, or is there some way to have 
that automatically doen for me in every method in every test in my 
testsuite?

    Thanks, Jason


RE: writing a test suite

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

> -----Original Message-----
> From: Jason Novotny [mailto:novotny@aei.mpg.de]
> Sent: 01 April 2003 10:12
> To: cactus-user@jakarta.apache.org
> Subject: writing a test suite
> 
> 
> Hi,
> 
> What is the easiest way to write a test suite for a particulaar web
> application containing a single servlet. With Junit before I would
> create a test suite that I could add individual tests in like so:
> 
> TestSuite suite = new TestSuite();
>         suite.addTest(new TestSuite(TestOne.class));
>         suite.addTest(new TestSuite(TestTwo.class));
>     ...

This is 100% the same with cactus.

> 
>     Basically do I have to do a "SampleServlet sample = new
> SampleServlet()" in every testXXX method, or is there some way to have
> that automatically doen for me in every method in every test in my
> testsuite?

I don't see the relationship between test suites and the new
SampleServlet(). You do the same in Cactus as you do in JUnit:


public class TestXXX extends ServletTestCase (for example)
{
   private SampleServlet servlet;

  public void setUp()
  {
    this.servlet = new SampleServlet();
  }

  public void testYYY()
  {
    servlet. ...
  }

  public void testZZZ()
  {
    servlet. ...
  }
}

Hope it helps,
-Vincent

> 
>     Thanks, Jason
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



Re: writing a test suite

Posted by Jason Arndt <ja...@yahoo.com>.
i don't think automatically, but you could use a class
variable and do it in the setUp method.

--- Jason Novotny <no...@aei.mpg.de> wrote:
> 
> Hi,
> 
> What is the easiest way to write a test suite for a
> particulaar web 
> application containing a single servlet. With Junit
> before I would 
> create a test suite that I could add individual
> tests in like so:
> 
> TestSuite suite = new TestSuite();
>         suite.addTest(new TestSuite(TestOne.class));
>         suite.addTest(new TestSuite(TestTwo.class));
>     ...
> 
>     Basically do I have to do a "SampleServlet
> sample = new 
> SampleServlet()" in every testXXX method, or is
> there some way to have 
> that automatically doen for me in every method in
> every test in my 
> testsuite?
> 
>     Thanks, Jason
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> cactus-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com