Have you consider using test suites? You'd have to explicitly specify what tests belong to which test suites, but it should get the job done.
http://open.ncsu.edu/se/tutorials/junit/#section3_0 This also can be used to solve the problem of tests executing in a specific order; some of our Selenium tests depend on the results of others (not my design choice, but I have to live w/ it). JUnit 4 can be used in conjunction with JUnit 3 test cases, but I don't see any point in migrating if you're using Java 1.4. On Sun, Mar 8, 2009 at 8:38 AM, Frédéric Camblor <[email protected]> wrote: > Hi there ! > > I am facing a problem with the current execution of maven surefire plugin. > > I work on several projects which have several test typologies : simple unit > tests, performance tests, db tests, integration tests, in-container tests > ... > => My problem is to be able to execute either one, few or every typologies > during my maven test execution. > > I think I can solve the problem by two ways : > - Use the "standard" way : use my test class FQN to determine the test > typologies. For example, I'll use the name "FooDBTest". > Then, I'll use profiles in order to change includes pattern > (**/*DB*Test.java for DB tests). > => Problem is : one test class can belong to several "typologies" (for > example, I'd want to execute some "in-container" db tests) => I'll have to > name my tests with horrible names like "FooDBInContainerIntegrationTest" > => I'm not really persuaded this is the best way ... > > - Use the "programmatic" way : use a super "MyTestCase" class which add an > abstract List getTestTypologies() method that every test classes will > override. > => Problem resides in the implementation of the surefire test runner : > somewhere, I should add my specific code which cast "TestCase" into > "MyTestCase" and work with test typologies. > => After having looked at surefire plugin (and dependencies) source code, I > think this will be hard to "cleanly incorporate" (bad thing that the > "JunitDirectoryTestSuite" cannot be overrided with plugin parameter > settings) > Moreover, even if I was able to build a "my-maven-surefire-plugin", would > it > be possible to branch it on the "standard" "test" maven goal, in place of > the original maven-surefire-plugin ??? > > > I want to precise some points : I can't migrate to TestNG nor Junit4 (for > the first one, because I rely on frameworks using Junit, like spring-mock & > DBUnit, for the second one because I can't use annotations due to java 1.4 > compilation) > > > If someone faced the same problem, I'm interested in ways to solve it, or > success stories ;-) > > Cheers, > Frédéric Camblor >
