How do I use RunWith to specify a Suite of test methods?
I have something like the following:
@开发者_开发百科RunWith(AllTestsRunner.class)
public class AllTests {
}
in which AllTestsRunner is a Suite that will return all test classes within the same package as AllTests. This works fine, but I would like to have finer-grained control than to just specify what the test classes are; I would like to be able to specify the test methods to be run (some of the test methods are annotated with @Category(Manual.class)
and these shouldn't be run in the continuous integration system). Is it possible to specify the Runner for AllTests?
Use:
@RunWith(Categories.class)
@Categories.ExcludeCategory(Manual.class)
@Suite.SuiteClasses(AllTests.class)
public class TestsToBeRunInCi {}
精彩评论