Eclipse没有看到我的新junit测试 [英] Eclipse doesn't see my new junit test
问题描述
如果我使用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 foldersrc/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屋!