Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run JUnit Test suite from command line

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.

like image 312
user448070 Avatar asked Oct 22 '10 08:10

user448070


People also ask

How do you run a suite in JUnit?

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.


1 Answers

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.

like image 175
topchef Avatar answered Sep 20 '22 13:09

topchef