I would like to do something like:
@RunWith(Categories.class)
@Categories.IncludeCategory(Small.class)
@Categories.ExcludeCategory({Manual.class, NonFunctional.class})
@Suite.SuiteClasses(AllTests.class)
public class SmallTests {
}
but ExcludeCategories accepts only one class, not an array of classes.
@IncludeCategory annotation indicates which categories will be included in execution. For the below example, we included SlowTest category and it will be executed. Thus, test method b() of class A, method c() of class B will be executed.
JUnit provides static methods to test for certain conditions via the Assert class. These assert statements typically start with assert. They allow you to specify the error message, the expected and the actual result. An assertion method compares the actual value returned by a test to the expected value.
This will be supported in JUnit 4.12 version, see https://github.com/junit-team/junit/blob/master/src/main/java/org/junit/experimental/categories/Categories.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With