I want to run a Junit test suite that contains various test classes.
From all tests, I want to exclude testing methods annotated with a specific annotation.
I know the @Ignore annotation, but I do not want to use it here because I want to be able to ignore different test methods if I call tests from different test suites.
I tried and it does not work. Running my package without @ExcludeCategory (IgnoreMeForSpecialReason.class) launches the same number of test cases as when working with @ExcludeCategory (IgnoreMeForSpecialReason.class)
To illustrate this:
This package
//version 1 @RunWith(Categories.class) @ExcludeCategory(IgnoreForSpecialReasonA.class) @SuiteClasses({ // add your test classes here Module1Test.class, Module2Test.class, Module3Test.class }) public class MySuiteA { }
the same number of tests are performed as this version of the package:
//version 2 @RunWith(Categories.class) //@ExcludeCategory(IgnoreForSpecialReasonA.class) @SuiteClasses({ // add your test classes here Module1Test.class, Module2Test.class, Module3Test.class }) public class MySuiteA { }
One test module1Test method is annotated using the @IgnoreForSpecialReasonA annotation. This method should be skipped in version 1 of my example, but it is running.
How can I make @ExcludeCategory really work with collections?
Hurrah!
nemoo source share