Languages

JUnit 5 error Process finished with exit code -1 - can't run unit test from Intellij idea

5 points
Asked by:
Efe-V
409

I included JUnit 5 maven dependency to my new project and created first test.

I can't start my unit test class, because I get error in Intellij idea:

Process finished with exit code -1

Screenshot of error:

Unit test:

package logic;

import org.junit.jupiter.api.Test;

public class InitTest {

    @Test
    public void test1() {
        System.out.println("a");
    }
}

Maven dependency:

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.6.2</version>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-engine</artifactId>
    <version>5.5.2</version>
</dependency>
<dependency>
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-runner</artifactId>
    <version>1.5.2</version>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-params</artifactId>
    <version>5.5.2</version>
</dependency>

How to solve this problem?

1 answer
2 points
Answered by:
Efe-V
409

You just need to use the same version of JUnit 5, the problem is with your first dependency version:

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.6.2</version>
</dependency>

Change it to the same version like the other 2 (junit-jupiter-engine and junit-jupiter-params) - version 5.5.2

This should fix the problem:

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.5.2</version>
</dependency>

Always try to use same release version of library.

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join