How to run JUnit tests by category in Maven?

前端 未结 8 1876
说谎
说谎 2020-11-28 21:59

Using JUnit 4.8 and the new @Category annotations, is there a way to choose a subset of categories to run with Maven\'s Surefire plugin?

For example I h

8条回答
  •  旧巷少年郎
    2020-11-28 22:11

    I was having issue running test with categories ex: @Category(com.mycompany.SlowTests.class) when running the test via mvn test -Dgroups=com.mycompany.SlowTests.class

    I discovered that tests in a classes without the word Test in their name would not run. After adding the word Test to the class the the tests in the class ran.

提交回复
热议问题