Surefire is not picking up Junit 4 tests

南笙酒味 提交于 2019-12-04 21:00:51

Surefire has a junit-version artifact detection mechanim that is being fooled by you using the junit artifact packaged by springsource. You need to set the junitartifactname parameter to org.junit:com.springsource.org.junit

I'm lost, I cannot reproduce your problem. But there is indeed a Jira issue (see EBR-220) explaining that you need to add the following to the surefire configuration when using the JUnit artifact packaged by SpringSource:

<junitArtifactName>org.junit:com.springsource.org.junit</junitArtifactName>

It's possible to use JUnit 4.x with maven 1.x :

* add Junit 4.X in your dependencies
* Use the JUnit4TestAdapter in your test classes :
  /**

* @return instance of this as Junit test case
  */
  public static junit.framework.Test suite() { return new JUnit4TestAdapter(MyTestClass.class); }

* run maven with a jdk >= 5
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!