119

My Java test worked well from Eclipse. But now, when I relaunch test from the run menu, I get the following message:

No tests found with test runner 'JUnit 4'

In the .classpath file I have all jar files, and at the end have:

<classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

How can I resolve this error and get tests running again?

Roman C
  • 49,761
  • 33
  • 66
  • 176
user281070
  • 1,341
  • 4
  • 11
  • 16

49 Answers49

173

this just happened to me. Rebuilding or restarting Eclipse didn't help.

I solved it by renaming one of the test methods to start with "test..." (JUnit3 style) and then all tests are found. I renamed it back to what it was previously, and it still works.

KatieK
  • 13,586
  • 17
  • 76
  • 90
Germán
  • 4,525
  • 3
  • 31
  • 37
  • this worked for me, as well. For a bit of extra confirmation. – Codeman Aug 16 '11 at 21:03
  • 8
    i have method like `testQuotes` along with other methods that do not start with test but still i get No tests found error – Rachel Jun 05 '12 at 19:31
  • 1
    I had the same problem with a class that extends `junit.framework.TestCase`, and my methods needed to begin with "test". Rather than extending `TestCase`, I added an import: `import static org.junit.Assert.*;`, and I can name my methods how I want. Bizarre... – MrDrews Apr 04 '13 at 16:57
  • It seems even worse with Kepler than with Juno... - strangely clean build doesn't help at all, only **explicitly changing the file helped** (e.g. by inserting and removing a space and then saving). Afterwards I can "Run As-JUnit Test" and it works. So - not the renaming but simply changing the file did the trick for me. – michael_s Aug 13 '13 at 06:26
  • Version: Kepler Release Build id: 20130614-0229 It works for this release. But, if I renamed the test back to its original, it would not work. Looks like it needs the word "test" at the beginning for some reason. – BudsNanKis Oct 17 '13 at 16:25
  • It seems that any edit of the file produces this result. – Erick G. Hagstrom Mar 29 '15 at 16:26
  • 8
    Seriously, even if a test is annotated with @Test, the test function name still needs to be prefixed with "test"? – Brian Shotola May 06 '15 at 16:14
  • 4
    You can add 2015 and Eclipse Luna to that list, too. Actually a great many of my @Test methods still start with the prefix "test". I _removed_ that prefix on one test, saved, and then all tests were found. Afterwards I added it back and all tests continued to be found. It seems it's more about changing a method (file?) such that Eclipse re-discovers everything. – Brian White May 31 '15 at 00:51
  • In 2016 too, with the AndroidJUnitRunner ! – Nicolas Albert Feb 11 '16 at 14:45
  • 1
    2016 regardless of AndroidJUnitRunner! – s1mm0t Feb 14 '16 at 19:40
  • This is still valid, for anyone that comes here wondering if it works. I'm using Eclipse Mars. – randombee Apr 21 '16 at 11:10
  • 2
    Android Studio 2.1.1, May 2016, still works. I wonder if this answer will work until the end of the universe. – Blueriver May 25 '16 at 23:50
  • Love this hack... August 2016 – Babu Aug 24 '16 at 08:48
  • Can't agree more with last posters. Still true in 2016 – Vortex Sep 05 '16 at 21:08
  • Hahahaha, this is nuts! I'm on Mars.2 - unfortunately, this didn't help me. It keeps telling me nothing is there. UPDATE: I undid the renaming and BOOM! It sprung to life. On Oct 21, 2016 – Powerslave Oct 21 '16 at 13:14
  • 1
    Remember to rename it to 'test(..)' not 'Test(...)' in my case it makes difference. – Kamil Witkowski Mar 02 '17 at 11:15
  • Thanks! This fixed my issue too! May 2017 – arc May 16 '17 at 10:33
  • Thanks, this solves my problem, but after renaming back, the same problem raise again. – Alanight Aug 02 '18 at 10:28
  • 1
    This helped me in 2019 with STS 3.9.8... are you f*n serious? – tObi Jul 31 '19 at 22:27
  • With Netbeans 8.02 this still happened, I wanted a very simple run that I've named "public void testIt()" => Netbeans returned no tests found... By renaming to "public void doASimpleTest()" this has worked. – frva Oct 17 '19 at 04:57
46

When we get these errors it seems like Eclipse is just confused. Restart Eclipse, refresh the project, clean it, let Eclipse rebuild it, and try again. Most times that works like a charm.

JamesG
  • 792
  • 6
  • 12
  • 1
    Yep worked for me too and agree with dlamblin. Good reminder to always try restarting for any odd problem that can't be solved in the first 5 minutes of prodding. – Thien Nov 05 '10 at 19:37
  • 3
    I had this problem, and I closed the source file where I'd defined my test class, double-clicked on that file in the navigator, and it worked. So closing and reopening the file worked, without restarting Eclipse. – metamatt Mar 02 '11 at 03:31
  • 12
    this really makes me want to look for a new IDE. this worked for me. – Seth M. Mar 02 '11 at 13:26
  • 2
    closing and reopeneing the project fixed it for me! – Martin Charlesworth Mar 06 '13 at 00:22
36

Check if your test class extends "TestCase". if so, remove that clause. Your class does not need to extend from "TestCase" class. It's most of the cases I've met.

public class MyTestCase extends TestCase{
  @Test
  public void checkSomething() {
    //...
  }
}
//Result> AssertionFailedError: No test Found in MyTestCase

Following TestCase should be fine.

public class MyTestCase {
  @Test
  public void checkSomething() {
    //...
  }
}
//Works fine
nephilim
  • 541
  • 6
  • 11
35

In context menu of your 'test' directory choose 'Build path' -> 'Use as a source folder'. Eclipse should see your unitTests.java files as a source files. Warning 'No JUnit tests found' occures because there is no unitTests.class files in your 'build' directory

Dima
  • 359
  • 3
  • 2
  • This is the solution that works for me. Restarting doesn't work. – Andree Aug 11 '12 at 10:45
  • This is what I was after since I have to have the "test" folder not in the "src" folder. I did this, then open/closed the project as suggested by the other answers and now it compiles and runs as a JUnit test. Thanks! – quux00 Aug 21 '12 at 17:42
  • I did the same by selecting the project -> Java build path -> Source -> add the test folder. Many thanks! – Peter Clause Feb 25 '14 at 15:56
  • If src/test/groovy is already on your build path as a source folder, remove it and then add it again. Easier than removing and replacing @Test in every test file... – geneSummons Dec 05 '17 at 22:19
28

I was facing the same problem and I debugged it to bad examples on the web and internals of junit. Basically don't make your class extend TestCase as some examples show for Junit 4.x. Use some naming convention Test or if you want to have an annotation you can use @RunWith(JUnit4.class).

If you need access to assert methods extend Assert or use static imports.

If your class extends TestCase then even if you use Junit 4 Runner it will be run as 3. This is because in the initialization code there is detection:

See JUnit3Builder and the lines:

boolean isPre4Test(Class<?> testClass) {
    return junit.framework.TestCase.class.isAssignableFrom(testClass);
}

This returns true and the test for junit4 compatibility won't be tried.

toomasr
  • 4,731
  • 2
  • 33
  • 36
  • 2
    This solved the problem for me. If you are looking at the older examples of how to use Junit first, they will lead you astray. – Alex Kilpatrick Feb 05 '11 at 18:03
  • "If your class extends TestCase then even if you use Junit 4 Runner it will be run as 3" - this is not true (at least for Groovy and Intellij IDEA). I'm using JUnit 4.12, and I have annotated the class with `@RunWith(JUnit4)` and extended from "GroovyTestCase". Without `@RunWith(JUnit4)` I face same issues. – Veaceslav Gaidarji Jan 10 '17 at 16:09
  • The behavior is still the same as of 2017 (JUnit 4.12). – sharmaap Apr 15 '17 at 17:17
7

Try Adding

@Test above the method for the test like this

@Test
public void testParse()
{

}
Mike Choi
  • 71
  • 1
  • 1
5

I have found out the answer:

I got this error when I executed the test standalone from eclipse (right click on the method and choose to run as junit test),

When I executed the complete class as junit test the test executed correctly with the parameters.

Eyal Zamir
  • 51
  • 1
  • 1
5

Yet another possible solution I'll throw into the ring: I wasn't able to run the test class either from the editor window, nor the Package Explorer, but right-clicking on the class name in the Outline view and selecting Run As JUnit Test did work... Go figure!

Matthew Wise
  • 2,639
  • 26
  • 23
  • same, from the outline view it works, everything else does not - i have tried every solution posted in 3 stack overflow threads, nothing works – MPSL May 02 '19 at 11:20
  • This works for me too, but is useless for testing coverage across a project. – rich Jun 24 '19 at 09:53
4

This happened to me as well. I tried restarting Eclipse and also prefixed my test-methods with tests. Neither worked.

The following step worked: Change all your test methods present in @BeforeClass and @AfterClass to static methods.

i.e. if you have your test method in the below format:

@BeforeClass
public void testBeforeClass(){
}

then change it to:

@BeforeClass
public static void testBeforeClass(){
}

This worked for me.

revindran
  • 66
  • 5
4

No testsuits in JUnit4. Use annotations instead or use old JUnit3 name conventions.

Example:

@RunWith(Suite.class)
@SuiteClasses({YourClassWithTests.class})
Roman C
  • 49,761
  • 33
  • 66
  • 176
3

When I face this problem I just edit the file and save it... works like charm

Mahesh
  • 31
  • 1
3

My problem was that declaration import org.junit.Test; has disappeared (or wasn't added?). After adding it, I had to remove another import declaration (Eclipse'll hint you which one) and everything began to work again.

kapa
  • 77,694
  • 21
  • 158
  • 175
Sergii
  • 1,017
  • 1
  • 10
  • 19
3

Very late but what solved the problem for me was that my test method names all started with captial letters: "public void Test". Making the t lower case worked.

Josh T
  • 31
  • 1
2

I tried the solution from Germán. It worked for all the method from my class but i have a lot of classes in my project.

So I tried removing from build path and then re-adding it. It worked perfectly.

Hope it helps.

Footix29
  • 21
  • 1
2

Six years later ... and there are still problems with Eclipse and occasionally not finding JUnits.

In my Eclipse Mars 2 I discovered that it won't recognise test classes pulled in from git if there are more than 9 or 10 @Test annotations in the file. I need to comment out any extra tests, run the test class, then uncomment them and re-run the class. Go figure...

SimonB
  • 539
  • 4
  • 8
  • This answer here is helpful, I didn't have exactly same situation, but test methods names were quite similar and eclipse had issue finding them. Like testCase01, testCare02... I had to comment other "testCasexx" methods in order to run testCase01 or else it throws an exception. Making all test methods PUBLIC seem to have resolved this issue!! – 01000001 Jun 17 '20 at 15:25
1

What fixed my case was similar to @JamesG's answer: I restarted Eclipse, rebuilt the project, and refreshed it; BUT before I did any of that, I 1st closed the project (right-click project in package explorer -> Close Project) and then re-opened it. Then it worked.

A workaround solution I found before finding that ultimate solution I just described: Copy the test class, and run the test class as JUnit.

cellepo
  • 4,001
  • 2
  • 38
  • 57
1

Check if the folder your tests are in is a source folder. If not - right click and use as source folder.

Todor Kolev
  • 1,432
  • 1
  • 16
  • 33
1

Close and open the project worked for me.

user3022123
  • 47
  • 1
  • 9
1

May be your JUnit launch configuration was for a individual test class, and you somehow changed that config to "run all tests in a source folder, package or project"

But that could trigger the "No tests found with test runner 'JUnit 4'" error message.

Or you did a modification in your test class, removing the @Test annotation.
See this wiki page.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @Test is here, the message is : could not faind main class toto.lolo.testrunner (which is specified in the run configuration ) – user281070 Feb 25 '10 at 09:54
  • @lamisse: so, some kind of classpath issue? or a syntex issue: it should be `toto.lolo.Testrunner` and not `toto.lolo.testrunner` ('T') – VonC Feb 25 '10 at 10:05
  • @lamisse : is "toto.lolo.Testrunner" the actual name of your TestRunner class ? Is it something you wrote ? Is the project / jar containing it in the classpath of your launch configuration ? – phtrivier Feb 25 '10 at 10:16
1

There is another chance, you might have changed Junit Test from lower version(e.g. Junit 3) to Junit 4 . Is so follow below steps:-

1. Right Click on class
2. Select Run as >> "Run Configurations"
3. Check your "Test Runner" option in new window
4. If it not same as maven change it for example change it as Junit 4.
Kundan Atre
  • 3,853
  • 5
  • 26
  • 39
1

Right Click the Project -> Build Dependencies -> remove the ones which have been excluded from the build path -> Click OK

Right Click the Project -> Maven -> Update Project.

You should be good to go..

MindBrain
  • 7,398
  • 11
  • 54
  • 74
1

You can fix this issue by do as following:

  • Right click on the folder named 'Test' > Build Path > Use as Source Folder
  • Or you can set classpath same as: <classpathentry kind="src" path="src/test/java"/> . You replace "src/test/java" by your test package

This issue happened because of junit cannot recognize your source code :D

Vu Truong
  • 1,655
  • 1
  • 12
  • 10
1

I've had issues with this recently, which seem to be fixed in the latest Eclipse.

eclipse-java 4.11.0,2019-03:R -> 4.12.0,2019-06:R

rich
  • 18,987
  • 11
  • 75
  • 101
1

Add @Test on top of your test.
Mouse hover to the annotation.
Chose 'add junit 4 library to classpath'

Mike
  • 20,010
  • 25
  • 97
  • 140
0

I had to do a mvn clean on command line then project->clean in eclipse. I renamed the class beforehand then renamed it back but i doubt that helped.

0

I'm also running Eclipse with Maven (m2e 1.4). The tests were running with Maven, but not with Eclipse... even after several application of Maven>Update project.

My solution was to add some lines in the .classpath generated by m2e. The lines are now sticking.

<classpathentry kind="src" output="target/test-classes" path="src/test/java">
  <attributes>
    <attribute name="optional" value="true"/>
    <attribute name="maven.pomderived" value="true"/>
  </attributes>
</classpathentry>
pascal
  • 3,287
  • 1
  • 17
  • 35
0

Is your Eclipse project maven based? If so, you may need to update the m2eclipse version.

Just a quick note: I have a project in Eclipse which is maven-based, and generated initially using the "new maven project" wizard in Eclipse. I'm using JUnit 4.5 for the unit tests, and could quite happily run the tests from the command line using maven, and individual tests from Eclipse using run as JUnit test.... However, when I tried to run all of the tests in the project by invoking run as JUnit test... on the project root node, Eclipse complained "no tests found with test runner junit 4". Solved by upgrading m2eclipse to the latest stable development build from the m2eclipse update site (specifically, I upgraded from version 0.9.8.200905041414 to version 0.9.9.200907201116 in Eclipse Galileo).

From here: http://nuin.blogspot.com/2009/07/m2eclipse-and-junit4-no-tests-found.html

b.roth
  • 9,421
  • 8
  • 37
  • 50
  • I do not understand, I do not think that it is related to eclispe version , my test worked yesterday and not the case now because of Junit launch popup is there a way to restet to my first configuration ? – user281070 Feb 25 '10 at 09:29
  • Lamisse, I'm confused too. I suggest that you update your question to explain when the unit test run works and when it does not work. – b.roth Feb 25 '10 at 09:34
0

I have this problem from time to time. The thing that resolves the issue most for me is to run the JUnit test from Run configurations... ensuring that JUnit 4 is set as the test runner.

Generally, I see this issue when attempting to Run As... Junit test from the context menu on the Package Explorer. If you right click the code for the test you are trying to run and instead of selecting Run As... Junit Test you select Run configurations... ensure the Project, Test Class and test runner are set correctly, clicking apply, then run works all the time for me.

theINtoy
  • 3,388
  • 2
  • 37
  • 60
0

I started to work with Selenium and Eclipse in my job and I was doing my first automated test and I deleted from the code @Before, @Test, and @After notes and I was having this issue "No tests found with test runner junit4".

My solution it was simply to add again the @Before, @Test and @After notes and with that my script worked. Is important to not delete this from the code.

This is a simple test that uses Google to search something:

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;

import org.junit.*;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class TestingClass {

    private WebDriver driver;
    //Creates an instance of the FirefoxDriver
    **@Before**
    public void SetUp() throws Exception {
        driver = new FirefoxDriver();
    }

    **@Test**   
    //Search using keyword through Google Search
    public void TestTestClass2 () throws Exception {
        driver.get("http://www.google.com.mx/");
        driver.findElement(By.name("q")).sendKeys("selenium");
        Thread.sleep(10000);
        driver.findElement(By.name("btnG")).click();
        Thread.sleep(10000);
    }

    //Kill all the WebDriver instances
    **@After**
    public void TearDown() throws Exception {
        driver.quit();
    }

}
JuanTorre
  • 1
  • 1
0

Using ScalaIDE (3.0.4-2.11-20140723-2253-Typesafe) I was having a similar problem with the Right Click Scala Test Class-> Run As -> Scala Junit Test context menu.

I tried editting the class(but not for a compile failure), cleaning, closing the project, closing Eclipse. None of those worked to restore the context menu for classes that had previously worked well. The test classes don't use the @Test annotation and instead use the @RunWith(classOf[JUnitRunner]) annotation at the top of the class using ScalaTest code.

When I tried choosing Scala Junit Test from the Run Configuration launch editor directly, I received the dialog from the question. Footix29's answer was the key for me.

I noticed that even though I had cleaned my project a few times, my classes in the /bin directory hadn't actually been rebuilt in a while.

Here's how I got back the context menu, and was able to once again run Scala Junit Tests:

  • manually cleaned the classes by deleting the /bin/<package dir>* via Explorer
  • Project -> Cleaned the project along with a full rebuild

I suspect that a class edit in general is able to clean some saved state of Eclipse and get it going again. In my case all of the previously working classes I tried had failed so the manual clean step was just the hammer I needed. However, other tricks that affect Eclipse's concept of the class path/build state should also work.

Further, I think that this behaviour was triggered in part by attempting to refactor a Scala class by renaming it( which the Scala Eclipse IDE sucks at ), where all the cleanup after the initial file change is manual. There were no build errors, but there were also no warnings that I was expecting meaning something was definitely stuck in Eclipse's build state info.

n0741337
  • 2,474
  • 2
  • 15
  • 15
0

This happened to me too. I found that in Eclipse I didn't make a new Java Class file and so that's why it wasn't compiling. Try copying your code into a java class file if it's not already there and then compile.

Anna
  • 1
0

My problem was using **

testng

** package org.testng.Assert;

You can replace it in libraries of the project (Maven) with JUnit and then need to refactor project.
OR add TestNG Eclipse plug-in

http://testng.org/doc/eclipse.html

mohsen.nour
  • 1,089
  • 3
  • 20
  • 27
0

I had this issue when my Java class name was similar to the Test class name. Just updated the name of the Test class by post fixing it with keywork "Test" and it started working

Before: Java class : ACMEController Test class : ACMEController

After: Java class : ACMEController Test class : ACMEControllerTest

Ravikiran butti
  • 1,668
  • 2
  • 11
  • 18
0

I found out that Eclipse seems to only perform JUnit 3 style tests if your test-class extends from TestCase. If you remove the inheritance, the annotations worked for me.

Beware that you need to statically import all the required assert* methods like import static org.junit.Assert.*.

Martin C.
  • 12,140
  • 7
  • 40
  • 52
0

In my case the issue was the generics parameters:

public class TestClass<T extends Serializable> {

removing :

<T extends Serializable>

and the option was available again.

I'm using Junit4

fidudidu
  • 399
  • 3
  • 10
0

You might be able to solve this simply by renaming your test class to have a name that ends with Test, e.g. ThisAndThatTest

0

Check for updates! Eclipse is no doubt fully aware of this problem considering how many workarounds have been presented. There is obviously something systemic involved...something that defies explanation or any sense of consistency. It would have been useful if Eclipse would have let the community know what the problem was and how it was fixed.

Another recent find for me was to delete any source directories that had no files or the all files were excluded.

Richard Jessop
  • 897
  • 1
  • 12
  • 19
0

I also faced the same issue while running JUnit test. I resolved this by putting the annotation @Test just above the main test function.

Rajith
  • 31
  • 2
  • 6
0

If you're sure it used to work and now it's not working anymore, chances are that the Java index got corrupted. In the preferences, search for "java index"; it's in "Java" and then there's a button "Rebuild Index" (or use Ctrl+3, "Find Actions", to quickly search for "Rebuild Java Index"). Once selected, the next time you try to run the JUnit test you should see that Eclipse is rebuilding the Java index and the JUnit tests should start now.

lorenzo-bettini
  • 2,106
  • 1
  • 16
  • 11
0

I ran into this issue because I had a @BeforeClass that was not static.

For some reason the error wasn't exposed through my normal junit run configuration.

Keith Tyler
  • 719
  • 4
  • 18
0

I tried all the answers above.

In my case my project had both junit4 and junit5 dependencies. I was trying to use junit4 so after making sure I used correct junit4 imports it still did not work.

I finally found the problem. The eclipse JUnit runner used in the debug configuration was set to JUnit5. I changed it to JUnit4 and the tests are now found and executed.

Nick
  • 328
  • 2
  • 10
0

Using JUnit4 and a Gradle-based project, none of the earlier suggestions worked in my case. What did work was:

  1. Right click your test source folder, and click Properties
  2. Jump to Run/Debug Settings
  3. Select all of the run/debug configurations, and delete them.

My guess is that one of these launch configurations was messing up my JUnit4 runner. Resetting all of the run/debug configurations solved JUnit4 not finding any tests to run.

jevon
  • 3,197
  • 3
  • 32
  • 40
0

I tried all of the suggestions above. Only deleting existing test run configurations for that class finally resolved it. Eclipse is weird...

nick_j_white
  • 534
  • 6
  • 27
0

ok In my case (using Junit5), if i tried to run with

@RunWith(MockitoJUnitRunner::class)

I got error

No tests found in ServiceImplTest
Is the method annotated with @Test?
Is the method public?
org.mockito.exceptions.base.MockitoException: 

No tests found in ServiceImplTest
Is the method annotated with @Test?
Is the method public?

Solution: Simply removing @RunWith(MockitoJUnitRunner::class) from Top of class worked!

Akash Verma
  • 638
  • 1
  • 11
  • 15
0

It might be silly, but I got the error making my @Test function private instead of public... too early in the morning.

Hmbucker
  • 115
  • 2
  • 10
0

I had to make the class public. Before I had 'class myTests' and making it 'public class myTests' allowed intelliJ to find the tests.

madeFromCode
  • 721
  • 7
  • 15
-1

There are two reasons for this Exception:

  1. The source code hasn’t been compiled YET.
  2. Or on the contrary, the source code has been compiled BUT it cannot been found by JUnit.

For reason one, it has no leg to stand. Because like many people said: the ‘old’ methods work perfectly. Only the new-added methods cannot been identified. Then the second reason became the only explanation: JUnit can NOT find the freshly compiled classes. Having that in mind, I did this: Right click the project ->Java Build Path -> Edit Source item: project_name/src/test/java’s Output folder, change the Output folder into a ‘Specific output folder(path relative to project_name). Provide this value: target/test-class. Be hold: This is the default test source codes’ output folder defined by Maven. It has been overwrote by M2E (or me). That’s why JUnit cannot find it. So my guess is many people who had run into this lovely exception are most likely dealing with a Web project which is managed by Maven. Am I right?! This also contributed my conclusion that reason one should be excluded -- “old” methods can be found is because they had been automatically compiled when the Tomcat was (re)started. Into the ‘wrong’ path maybe, but JUnit found it anyway.

Before I had figured this out. I tried many things as advised: update to the latest JUnit4, Back and forth between build path and use as source folder, capital Test vs test, etc. Nothing happened until I specifically identified the output location for the test source. With all those explanation, my second reason should be re-phrased as this: the new codes had not been timely compiled to the right path! Good luck.

Heather
  • 9
  • 2
-1

I also faced this Issue while implementing @RunWith(Cucumber.class). Since this annotation was inside a Public class and hence Eclipse Shows this "No tests found with test runner not found" error.

Once I called / placed the test runner annotation before the runner class, The tests showed up nicely.

Readers must identify which Junit Test Runner they are using. One can check with @RunWith(JUnit4.class) is Outside or inside the runner.class parenthesis {}. If its inside, Please place it outside.

StefanM
  • 797
  • 1
  • 10
  • 17
Himadri
  • 150
  • 2
  • 11
-1

If you are trying to setup junit 5 add @RunWith(JUnitPlatform.class)

and import org.junit.platform.runner.JUnitPlatform; so that eclipse can recognize the junit 5 test classes as test classes

Anand Rockzz
  • 6,072
  • 5
  • 64
  • 71