Languages

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

2 points
Asked by:
JustMike
26670

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:
JustMike
26670

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
Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - friendly IT community for everyone.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join