Eclipse没有看到我的新junit测试 [英] Eclipse doesn't see my new junit test

查看:359
本文介绍了Eclipse没有看到我的新junit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用eclipse在单个junit(4)测试类中运行测试。课堂上的考试都很好。然后我添加一个额外的测试,并通过再次运行在ecplise中的测试运行该类。只有旧的测试才能运行。新测试没有被eclipse看到。没有错误或任何东西,就像eclipse正在查看旧版本的测试。



如果我使用maven运行测试,一切都正常。另外,在maven中运行测试之后,ecplipse可以正确地看到并运行新测试。



任何想法发生了什么?任何想法如何让ecplipse的测试运行器看到我的新测试用例?

解决方案

我有同样的问题。我通过执行以下操作来解决它:




  • 转到项目 - >属性 - > Java构建路径

    对于源文件夹 src / test / java ,输出文件夹设置为
    默认输出文件夹

  • 将其设置为您的Maven结构中典型的Maven target / test-classes 目录



之后,Maven和Eclipse是同步的(而不是Eclipse快乐地运行旧版本的测试,从最后一个Maven编译)。


I'm using eclipse to run the tests in a single junit(4) test class. The tests in the class all run just fine. Then I add an additional test and run the class through the test running in ecplise again. Only the old tests are run. The new test isn't seen by eclipse. There's no error or anything, it's just as if eclipse is looking at an old version of the test.

If I run the tests using maven, everything works fine. Additionally, after I run the tests in maven, ecplipse can see and run the new test correctly.

Any ideas what's going on? Any ideas how to get ecplipse's test runner to see my new test cases?

解决方案

I had the same issue. I solved it by doing the following:

  • Going to Project -> Properties -> Java Build Path
    For the source folder src/test/java, the output folder was set to "Default output folder"
  • Setting this to the typical Maven target/test-classes directory in your Maven structure

After this, Maven and Eclipse were in sync (as opposed to Eclipse happily running an older version of the tests, from whenever the last Maven compile was).

这篇关于Eclipse没有看到我的新junit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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