[英]Running maven test on a specific class - [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test
Getting the following issue. 得到以下问题。 When I run
mvn test -Dtest=MyClassTest
当我运行
mvn test -Dtest=MyClassTest
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test
(default-test) on project my-project: No tests were executed! (Set -DfailIfNoTests=false to
ignore this error.) -> [Help 1]
But I have 10 other classes in the same project but on a different path. 但是我在同一项目中有10个其他类,但是路径不同。 I ran all of them like this and those all run fine.
我像这样跑所有的人,一切都很好。 But mvn test is not identifying just this one.
但是mvn测试不仅仅可以识别这一点。 Could there be any problems?
可能有什么问题吗?
I reviewed the same errors that people got, but was proposed different solutions like upgrade, etc. But for me, all tests run fine, except this one. 我检查了人们遇到的相同错误,但是提出了不同的解决方案,例如升级等。但是对我来说,除此测试外,所有测试都运行良好。 So I am kind of in limbo, if I am missing something.
因此,如果我缺少某些东西,我会陷入困境。
For those that have the same issue. 对于那些有相同问题的人。 Its my blunder (maybe).
这是我的失误(也许)。 The
@Test
annotated method has no access specifier. @Test
注释的方法没有访问说明符。 I just use void method(). 我只是使用void method()。 I added
public
and it started working! 我添加了
public
,它开始起作用!
Thanks @user2507946. 感谢@ user2507946。 Running from IDE help solve the issue.
从IDE运行有助于解决该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.