Unit test class runs old version in eclipse

前端 未结 3 1884
无人及你
无人及你 2021-01-18 04:24

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

相关标签:
3条回答
  • 2021-01-18 05:07

    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.

    0 讨论(0)
  • 2021-01-18 05:10

    Another solution would be manually deleting the "target" folder of the project and rebuilding it. This should solve all problems of this kind.

    0 讨论(0)
  • 2021-01-18 05:11

    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.

    0 讨论(0)
提交回复
热议问题