Suspended
Suspended

Reputation: 1190

JUnit 4 tests results not showing in Eclipse

My problem is that JUnit 4 test results are not showing in Eclipse. I have added System.out.println("....") to each of @Test methods in my test class and they ran cause Console shows the output, however, the JUnit tab next to my package explorer is not showing any results. It says runs 0/0, errors 0, failures 0.

I should add that I have added JUnit 4 to build path. I browsed the internet in search of an answer for like an hour and didn't find anything. What is the problem here? I would really appreciate any clue!

Upvotes: 1

Views: 4366

Answers (2)

Nano Taboada
Nano Taboada

Reputation: 4182

I had the same issue while working with Spring Boot 2.5.1

Essentially, starting with Spring Boot 2.4, JUnit 5's vintage engine has been removed from spring-boot-starter-test. If we still want to write tests using JUnit 4, we need to add the following Maven dependency:

<dependency>
    <groupId>org.junit.vintage</groupId>
    <artifactId>junit-vintage-engine</artifactId>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Upvotes: 2

Ping Amos
Ping Amos

Reputation: 11

I have same problem. I try everything , but still fail to shown junit4 result in Eclipse, but I think maybe this problem is eclipse bug. My environments is Mac OS 11x EI and Eclipse Mars for 64 mac, and JDK is 1.7 I use the same Eclipse Mars (for windows x86) in my pc , it's OK. so I can think only may be is a environment's problem.

At last, I try jdk 1.6 + eclipse luna for mac(32),it's work!!, so you can try other eclipse version.

Upvotes: 1

Related Questions