Languages

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

2 points
Asked by:
JustMike
3518

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 answers
2 points
Answered by:
JustMike
3518

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
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.