Hi Maria, > -----Original Message----- > From: Maria Sole Franzin [mailto:[EMAIL PROTECTED] > 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 packege > indipendet from the package of the entity bean, even if the sessionbean > 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 inside > 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. -Vincent > > Thank in advance > > Mariasole > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
