How to run JUnit tests by category in Maven?

前端 未结 8 1875
说谎
说谎 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:26

    I lost lot of time on this error "groups/excludedGroups require TestNG or JUnit48+ on project test classpath" because I thought I was using a bad version of junit, or a bad version of the surefire plugin, or a combination that does not fit.

    It was none of that: in my project I had a "config" module that was built before the module I wanted to test. This module had no junit dependency -> it had no junit on the classpath...

    This mistake may help others...

提交回复
热议问题