Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory

前端 未结 30 2476
盖世英雄少女心
盖世英雄少女心 2020-11-29 22:31

The problem

Whenever I run my projects JUnit test (using JUnit 5 with Java 9 and Eclipse Oxygen 1.a) I encounter the problem that eclipse can\'t find any tests.

30条回答
  •  情话喂你
    2020-11-29 23:14

    From the start the error message tell you that class is not found : NoClassDefFoundError that mean the PATH to junit is the problem.

    1. Press right click to project folder and choose Properties OR select project folder and press combination cmd + i.

    2. select from list "Java Build Path".

    3. select "Libraries" tab
    4. If JUnit 5(or JUnit 4) is added to "Modulepath", select the "JUnit 5" and press Remove.
    5. select "Classpath", press "Add Library...".
    6. from opened "Add Library" window, select JUnit, press next.
    7. Select JUnit library version that you need and press Finish.

    That is all. Try to run test again.

提交回复
热议问题