I have a JUnit test class in my project which is updated incrementally - I add tests every few weeks and sometimes modify the tests\' code.
Surprisingly, when I run
I had the same issue. It was due to a defective .classpath. Removing this .classpath and re-importing the project, generates a correct .classpath and fixed the environment.
Another solution would be manually deleting the "target" folder of the project and rebuilding it. This should solve all problems of this kind.
I managed to solve the problem on my own (inspired by a comment contributed by Harlard). After examining the target directory of my project, I noticed that the test-classes dir inside it doesn't include the binaries of my test. I then noticed that I misplaced the classes within src/test/java and put them in a package structure that doesn't conform to the package structure of my project, they were direct sub-directories of src/test/java. Therefore, eclipse didn't put them in the correct place and the only way to generate binaries for them was by executing a maven build. After refactoring all my test classes to the correct package structure, everything worked perfectly.