I created a JUnit 4 test in Eclipse by right-clicking on a Java class and selecting New JUnit Test Case. When I right-click the test class I get "Run on Server", but not "Run as JUnit Test". I am using Eclipse 3.6.1.
I created a JUnit 4 test in Eclipse by right-clicking on a Java class and selecting New JUnit Test Case. When I right-click the test class I get "Run on Server", but not "Run as JUnit Test". I am using Eclipse 3.6.1.
In case you experience it in maven project add following into pom.xml and reload project using Alt+F5. Tests do not work because old JDK version.
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Make sure that you include import org.junit.Test; and the tests have @Test before them, I have missed that before when coping some functions from other files.
To solve the situation, a restart of eclipse wasn´t enough in my case, I had to remove and re-add the project to my workspace as well.
If, the configuration is of SpringRunner.class for Junit. Make sure your maven clean install with maven update and refresh is run in your project with right jdk and mavens password/configuration.