Hi,

I have experimented to run a collection of test cases as a suite in maven with surefire 2.3 (which supports JUnit 4.2). The following is an example to demonstrate how we can achieve it.

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

// The Runner class from JUnit 4.x
@RunWith(Suite.class)
// The test cases to be included in the suite
@SuiteClasses( {CompositeServiceReferenceTest.class, ComponentTest.class, ComponentServiceReferenceListTest.class, CompositeServiceReferenceForRefOverrideTest.class, ComponentServiceReferenceTest.class, CompositeOneServiceTest.class, CompositeTest.class, CompositeOneService2LevelTest.class})

public class SpecAllTestCase {
   @BeforeClass
   public static void init() {
       // We might do SCARuntime.start() here
   }

   @AfterClass
   public static void destroy() {
       // We might do SCARuntime.stop() here
   }
}

I have a few items to be agreed.

1) What's the naming convention for test suites? Should we name them as "*TestSuite.java"? If so, we have to adjust the surefire inclusion pattern in pom.xml to recognize the test suites. If we're fine with names such as "*AllTestCase.java", then the current pattern can work as-is.

2) For those test cases intended to be run as part of a suite, I guess we should name them as something like "*Test.java" which doesn't match the surefire inclusion pattern. This way, these test cases will not be run out of the suite. Right?

Thanks,
Raymond

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to