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: how to use in the better way ServletTestSuite with EJBs
Date Mon, 22 Dec 2003 13:39:36 GMT
Hi Maria,

> -----Original Message-----
> From: Maria Sole Franzin [mailto:mariasole.franzin@allos.it]
> Sent: 22 December 2003 10:18
> To: 'Cactus Users List'
> Subject: how to use in the better way ServletTestSuite with EJBs
> Hi All,
> I'm testing my EBJs with cactus 1.5, and i'd like to test all by a
> ServletTestSuite, or a simply Suite.
> I did it defining this class:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> package test.suite;
> import junit.framework.*;
> import org.apache.cactus.*;
> public class AllTests
>     extends ServletTestSuite {
>   public AllTests(String s) {
>     super(s);
>   }
> public static Test suite() {
>     	TestSuite suite = new TestSuite();
>     	suite.addTestSuite("sessioncactustest".class);
>  	suite.addTestSuite("entity1cactustest".class);
>     	suite.addTestSuite("entity2cactustest".class);
>     	return suite;
>   }
> }

Quick note: This will not work. You must not put quotes around your
class name. If you do , "whatever".class will result in java.lang.String
... :-)

> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> This suite works fine, 

I would be surprised if it worked! String classes are not TestCase
classes :-)

> but I can't create a hierarchy of test, I think
> it's cause of the project architecture: the session bean is in a
> indipendet from the package of the entity bean, even if the
> calls the two entityBean.

I don't undertsand this statement.

> So the question are two:
> - why I have to use a SevletTestSuite that is a simply wrapper of the
> junit TestSuite, isn't the same of using a TestSuite????

You don't. If your test cases extends ServletTestCase (or JspTestCase or
FitlerTestCase) then you *must* not wrap them in a ServletTestSuite. The
ServletTestSuite must be used only for running pure JUnit test case
(i.e. classes that extends TestCase) on the server side.

> - how may i define a test hierarchy??? Do i have to call a suite
> a   suite???

Yes. This is the JUnit way.

Alternatively, it depends on how you plan to run your tests. If you're
using Ant, I'd suggest your use the <batchtest> element instead of the
<test> one. It will run all the tests automatically without the need to
write TestAll classes.


> Thank in advance
> Mariasole
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org

View raw message