score:37
Make sure your eclipse environment is using JUnit 4. JUnit 3 doesn't make use of annotations (it uses the old extends TestCase
style)
There are few things to double check:
Window > Preferences > Java > JUnit
Are you seeing junit4
or junit3
imports? If that looks good, make sure the project itself is using JUnit4 instead of JUnit3.
Right Click on project > Properties > Java Build Path > Libraries
Is JUnit4 included there? Is anything JUnit related there? If JUnit3 is in there, click on it and click Remove
. Then click Add Library...
and follow the prompts from there to add JUnit again.
Out of curiosity, are the JUnits run outside of eclipse? Like with a mvn install
or whatever build target you have for Ant that'll run JUnits
score:-1
Make sure you are using Junit as your testing framwork and not something like TestNg which cover most of Junit's purpose.
score:0
I encountered the same issue and verified all the settings (above mentioned) are fine. A small change (version to 1.5.21.RELEASE from 2.5.0-M2) in pom.xml resolved my issue (below). This Iam able to recreate consistently.
STS Details Version: 3.9.0.RELEASE Build Id: 201707061823 Platform: Eclipse Oxygen (4.7.0)
Pom.xml change
FROM
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
**<version>2.5.0-M2</version>**
<relativePath/> <!-- lookup parent from repository -->
</parent>
TO
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
**<version>1.5.21.RELEASE</version>**
<relativePath /> <!-- lookup parent from repository -->
</parent>
score:3
score:4
Write a simple test case to see if Eclipse works correctly or not. If simple test case can be run, check your testcase, especially import classes.
Or make a try in "Run" -> "Run Configurations",fill the "Test class" as "TeamTest
"(full class name). Then click "Run", see what will happen...
Source: stackoverflow.com
Related Query
- can't find run as junit test in eclipse
- Can't run JUnit 4 test case in Eclipse Android project
- Is there a way to make Eclipse run a JUnit test multiple times until failure?
- Eclipse Junit run configuration that takes the current selected test class as an arg?
- How to kill a JUnit test run in Eclipse that has entered an infinte loop
- Keyboard shortcut for Run As -> Android JUnit Test in Eclipse
- Unable to run JUnit test cases after converting project to Gradle in Eclipse
- Cannot run a JUnit test case containing threads from Eclipse
- Why is Eclipse reporting a JUnit compilation error when I can compile and run the test fine in a terminal?
- JUnit Eclipse can't run unit test
- Junit 4 + Eclipse - Run inner class test cases with SpringJUnit4ClassRunner as well
- Unable to run junit plugin test Eclipse 4
- Eclipse grails run as JUnit test
- Cannot run JUnit test from Eclipse Plugin
- Junit test not found system property when run from Eclipse
- How do I get my Eclipse JUnit test run to behave the same as running the test on the mvn command line?
- Run a JUnit test from an Eclipse Plugin and accessing the result
- Cannot run single unit test with JUnit and Eclipse for data-driven testing
- Eclipse cannot run JUnit 5 test cases in JUnit suite?
- Eclipse cant find some of the JUnit files
- Unable to run JUnit 5 test case on latest Eclipse Jee 2019-09
- junit runs fine when run with gradle on command line but fails to run on eclipse as a junit test
- How to run JUnit Test Classes in Java Main Application using Maven and Eclipse
- How to run a JUnit test in Eclipse that uses an older version of org.eclipse.equinox.common?
- How to run JUnit test in Eclipse
- Cant run JUnit test due classpath issue
- JUnit HTML report (index.html) is not generated in the JUNIT folder, If I run the test case through ANT in eclipse
- How to setup Eclipse to run a login Junit test before each test for Android testing?
- Possible to run a given JUnit test programatically from my own Eclipse Plugin? How?
- How to do a clean build in eclipse and run a junit test case at startup?
More Query from same tag
- Converting an Eclipse Java project to a Google AppEngine one
- redrawing is not working properly using invalidate
- Eclipse project and Maven pom file not in same directory
- Zoom GEF Application in Eclipse 4 Environment
- Clear command line output from Python [Eclipse]
- Pydev Eclipse auto suggestion do not showing string.split() method
- Keyboard shortcut for opening full editor for file being compared in svn
- ADT R22 - Proguard - Can't find referenced class
- How to transfer project written in Eclipse?
- Application design in Eclipse RCP
- Debugging hangs with "Application is waiting for debugger to attach" on Android with Eclipse
- Data retrieving - JDBC with Eclipse
- I need to get maven folder while creating project
- How can I work around Eclipse ADB unable to establish loopback connection?
- Checking out a github release in Eclipse egit?
- eclipse: 'failed to create the part's controls' error, StringIndexOutOfBoundsException
- How to automate pmd eclipse plugin execution?
- Windowbuilder Pro - selectedElement binding not working
- Eclipse's "Export Runnable JAR" and Maven's "package" command
- Install new software in Eclipse Luna gives always the error No repository found containing: osgi.bundle,org.eclipse.net4j.jms.api?
- Pydev/OpenCV: Installation Errors
- Maven does not download dependencies from local repository
- How do I get the value of the slider's position in Qt Eclipse?
- Unable to create a new project without error
- Why source folder missing from build path during creating Dynamic Web Project in Eclipse
- Eclipse Tomcat Build Publishing slow
- Deleting an entry in SQLite database
- Android Studio (IntelliJ) Error Message
- Insufficent space for shared memory file when i try the run command on eclipse
- How to run class files from jar file, where class files are in bin filder