未发现测试运行程序“JUnit 4"的测试 [英] No tests found with test runner 'JUnit 4'

查看:40
本文介绍了未发现测试运行程序“JUnit 4"的测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Java 测试在 Eclipse 中运行良好.但是现在,当我从运行菜单重新启动测试时,我收到以下消息:

My Java test worked well from Eclipse. But now, when I relaunch test from the run menu, I get the following message:

No tests found with test runner 'JUnit 4'

.classpath 文件中我有所有 jar 文件,最后有:

In the .classpath file I have all jar files, and at the end have:

<classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

如何解决此错误并重新运行测试?

How can I resolve this error and get tests running again?

推荐答案

这刚好发生在我身上.重建或重新启动 Eclipse 没有帮助.

this just happened to me. Rebuilding or restarting Eclipse didn't help.

我通过将其中一种测试方法重命名为以test..."(JUnit3 样式)开头,然后找到所有测试来解决该问题.我把它改回了以前的样子,它仍然有效.

I solved it by renaming one of the test methods to start with "test..." (JUnit3 style) and then all tests are found. I renamed it back to what it was previously, and it still works.

这篇关于未发现测试运行程序“JUnit 4"的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆