How do I run a Junit 4.8.1 Test suite from command line ? Also I want to use the categories introduces with JUnit 4.8 , is there a way where I can specify from command line the category which I want to run.
Test suite is used to bundle a few unit test cases and run them together. In JUnit, both @RunWith and @Suite annotations are used to run the suite tests. This chapter takes an example having two test classes, TestJunit1 & TestJunit2, that run together using Test Suite.
Using java
run JUnitCore class (also see here).
Categories are supposed to be used with test suites with @RunWith(Categories.class)
, @IncludeCategory
and @ExcludeCategory
. I am not aware of any dynamic way to use categories to run tests but I'd like to know of such it it exists. You can have pre-defined test suites for certain categories to run them.
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