Eclipse doesn’t see the new junit test

eclipsejunit

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?

Best Answer

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).