Surefire没有接受Junit 4测试

Surefire没有接受Junit 4测试,第1张

Surefire没有接受Junit 4测试

mvn -X
帮助我揭示了以下内容:

...[INFO] [surefire:test {execution: default-test}][DEBUG] dummy:dummy:jar:1.0 (selected for null)[DEBUG]   org.apache.maven.surefire:surefire-booter:jar:2.4.3:runtime (selected for runtime)[DEBUG]     org.apache.maven.surefire:surefire-api:jar:2.4.3:runtime (selected for runtime)[DEBUG] Adding to surefire booter test classpath: /home/mindas/.m2/repository/org/apache/maven/surefire/surefire-booter/2.4.3/surefire-booter-2.4.3.jar[DEBUG] Adding to surefire booter test classpath: /home/mindas/.m2/repository/org/apache/maven/surefire/surefire-api/2.4.3/surefire-api-2.4.3.jar[DEBUG] dummy:dummy:jar:1.0 (selected for null)[DEBUG]   org.testng:testng:jar:jdk15:5.8:test (selected for test)[DEBUG]     junit:junit:jar:3.8.1:test (selected for test)[DEBUG] Adding to surefire booter test classpath: /home/mindas/.m2/repository/org/testng/testng/5.8/testng-5.8-jdk15.jar[DEBUG] Adding to surefire booter test classpath: /home/mindas/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar[DEBUG] dummy:dummy:jar:1.0 (selected for null)[DEBUG] Retrieving parent-POM: org.apache.maven.surefire:surefire-providers:pom:2.4.3 for project: null:surefire-testng:jar:null from the repository.[DEBUG] Adding managed dependencies for unknown:surefire-testng[DEBUG]   org.apache.maven.surefire:surefire-api:jar:2.4.3[DEBUG]   org.apache.maven.surefire:surefire-booter:jar:2.4.3[DEBUG]   org.prehaus.plexus:plexus-utils:jar:1.5.1[DEBUG]   org.apache.maven.surefire:surefire-testng:jar:2.4.3:test (selected for test)[DEBUG]     org.apache.maven:maven-artifact:jar:2.0:test (selected for test)[DEBUG]       org.prehaus.plexus:plexus-utils:jar:1.0.4:test (selected for test)[DEBUG]     junit:junit:jar:3.8.1:test (selected for test)[DEBUG]     org.testng:testng:jar:jdk15:5.7:test (selected for test)[DEBUG]     org.apache.maven.surefire:surefire-api:jar:2.4.3:test (selected for test)...[DEBUG] Test Classpath :...[DEBUG]   /home/mindas/.m2/repository/junit/junit/4.7/junit-4.7.jar

因此,似乎问题出在

testng
需要JUnit v3.8.1的jar中。即使
Test Classpath
设置为依赖JUnit 4,也为时已晚。

testng
依赖项位于我的POM中:

<dependency>  <groupId>org.testng</groupId>  <artifactId>testng</artifactId>  <version>5.8</version>  <scope>test</scope>  <classifier>jdk15</classifier></dependency>

在我将其注释掉之后,立即开始执行测试。

得到教训:

  • mvn dependency:tree
    并不总是足够的,
    mvn -X
    是朋友。
  • surefire不是为开发人员准备的(我在查看JIRA项目报告时已经意识到这一点)。尤其是因为使用Maven时没有其他选择。

谢谢大家的帮助。不幸的是,没有办法在Pascal和Kaleb之间分配答案,但是Kaleb的使用建议

mvn-X
帮助我走上了正确的道路,所以正确的答案就归于他。



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5479030.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-12
下一篇 2022-12-12

发表评论

登录后才能评论

评论列表(0条)

保存