Using JUnit 4.8 and the new @Category annotations, is there a way to choose a subset of categories to run with the Maven Surefire plugin?
For example, I have:
@Test public void a() { } @Category(SlowTests.class) @Test public void b() { }
And I would like to run all the slow tests, as in: (note that -Dtest.categories was compiled by me ...).
mvn test -Dtest.categories=!SlowTests // run non-slow tests mvn test -Dtest.categories=SlowTests // run only slow tests mvn test -Dtest.categories=SlowTests,FastTests // run only slow tests and fast tests mvn test // run all tests, including non-categorized
So the thing is, I donโt want to create test suites (Maven just selects all the unit tests in the project, which is very convenient), and I would like Maven to be able to select tests by categories. I think I just compiled -Dtest.categories, so I was wondering if there is a similar tool that I can use?
java maven junit maven-surefire-plugin categories
Ran Jun 23 '10 at 10:47
source share