I'm using Surefire 2.3 to test with JUnit 4, and it seems as though my tests' suite() methods aren't being used by the Surefire booter. Does it simply look for the "@Test"-annotated tests manually?

I'm using suite() because I have a couple of Parameterized tests implemented as inner classes of another (non-Parameterized) test, and I'd like the outermost test class's suite() to add the Parameterized tests to it, like so:

public class FooTest {

  public static junit.framework.Test suite() {
    TestSuite suite = new JUnit4TestAdapter(FooTest.class);
    suite.addTest(new JUnit4TestAdapter(BarParamTest.class));
    suite.addTest(new JUnit4TestAdapter(BatParamTest.class));

    return suite;
  }

  @RunWith (value = Parameterized.class)
  public static class BarParamTest {
    ...
  }

  @RunWith (value = Parameterized.class)
  public static class BatParamTest {
    ...
  }
}

This is partly to keep all tests related to Foo in the same file (whether they're parameterized or not), and partly because Surefire excludes inner classes. I could make sure that my inner classes are named *Test and add a pattern like "**/*$*Test.class" to my includes, but that's not as obvious to future maintainers that that's how the inner classes are getting invoked.

Any ideas?


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

Reply via email to