3

Assuming I have a simple test:

import org.junit.jupiter.api.Test;

public class MyTest {

    @Test
    public void test() {

    }

}

With only JUnit5 as a dependency

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.2.0</version>
        <scope>test</scope>
    </dependency>

If I click 'Run as' on the class, it doesn't show up the usual 'JUnit test' option. If I manually add a run configuration, select the class and select the JUnit 5 runner, it runs properly.

But the 'run as junit test' option is just gone for classes, packages, projects.

Does it work for anyone?

  • It works for me, but I initially had the same error that was caused by one of the JUnit 5.2 JAR files being corrupted. Deleting JUnit in the Maven repository and downloading it again, fixed my issue. – howlger Aug 24 '18 at 12:44
  • 1
    Had the same issue. It worked for me after re-starting Eclipse (such an unsatisfying fix) – mihca Jun 30 '19 at 17:45
  • To also get "Run as..." > "JUnit Plug-in Test" I had to add org.junit as dependency. – mihca Jun 30 '19 at 17:46
  • @mihca Eclipse restart. It worked. That's what I call a life saver comment! – David Lakatos Jul 11 '19 at 13:30

0 Answers0