"No tests found for given includes" when running Gradle tests in IntelliJ IDEA

Arrovil

I cannot run tests via Gradle in IntelliJ IDEA because of "No tests found for given includes" error.

How can I fix it?

GradleTests

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;

public class GradleTests {
    @Test
    public void initTest() {
        assertTrue(true);
    }
}

build.gradle

plugins {
    id 'java'
}

group 'org.example'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    //testCompile group: 'junit', name: 'junit', version: '4.12'

    // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.0'
}

test {
    useJUnitPlatform()
}

Error:

> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [GradleTests.initTest](filter.includeTestsMatching)

Some notes:

  • Issue is reproduced with both JUnit 4 and 5
  • IntelliJ IDEA 2019.3.3 (Community Edition), Build #IC-193.6494.35, built on February 11, 2020
  • Test is in src/test/java
  • changing runner like Intelij 2019.1 update breaks JUnit tests didn't help
  • without useJUnitPlatform() result is the same
Arrovil

Thanks to Ben Watson I've found solution. Since JUnit 5.4.0 there is aggregate artifact with both api and engine dependencies. So just adding one dependency to build.gradle resolved this issue.

testCompile ('org.junit.jupiter:junit-jupiter:5.6.0')

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

A problem in showing Unicode Character when running Java artifact, but everything ok while running in IntelliJ IDEA

From Java

No tests found for given includes Error, when running Parameterized Unit test in Android Studio

From Dev

Gradle: optimize running tests in parallel

From Dev

Running Unit and Integration Tests in IntelliJ

From Dev

Play framework 2 running unit tests in Intellij IDEA 13

From Dev

Gradle running tests sequentially

From Dev

IntelliJ IDEA 13: Keyboard shortcuts to navigate stack trace after running tests?

From Dev

How to automate running tests before commit in Intellij Idea, without additional software?

From Dev

Empty benchmarks when running JMH samples in Intellij IDEA

From Dev

Skip tests in IntelliJ using Gradle

From Dev

intellij idea 14 and gradle issues when running integTests

From Dev

IntelliJ NoClassDefFoundError when running IntelliJ Tests

From Dev

Running jest tests directly in Intellij Idea/WebStorm?

From Dev

Gradle not running tests

From Dev

Intellij IDEA and Gradle projects

From Dev

"Address already in use: bind" exception when running Gradle JUnit tests

From Dev

Running Spark Unit Tests in IntelliJ

From Dev

ActiveMQ in-memory broker not starting when tests running in IntelliJ IDEA

From Dev

Set up environment variables for Gradle Runner and JUnit tests on Intellij Idea

From Dev

Gradle project running jUnit 5 tests in IntelliJ

From Dev

OpenEJB Logger configuration when running tests from TestNG in Intellij IDEA

From Dev

Stop debug mode in IntelliJ IDEA when using Gradle

From Dev

"No tests found for given includes" when running Gradle tests in IntelliJ IDEA

From Dev

Gradle daemon not reused when running in debug mode (in IntelliJ IDEA)

From Dev

No tests found for given includes:

From Dev

Gradle project running jUnit 5 tests in IntelliJ

From Dev

java.lang.ClassNotFoundException when running in IntelliJ IDEA

From Dev

IntelliJ IDEA Error Running Application

From Dev

Always getting 404 when running Spring Boot Gradle app in IntelliJ

Related Related

  1. 1

    A problem in showing Unicode Character when running Java artifact, but everything ok while running in IntelliJ IDEA

  2. 2

    No tests found for given includes Error, when running Parameterized Unit test in Android Studio

  3. 3

    Gradle: optimize running tests in parallel

  4. 4

    Running Unit and Integration Tests in IntelliJ

  5. 5

    Play framework 2 running unit tests in Intellij IDEA 13

  6. 6

    Gradle running tests sequentially

  7. 7

    IntelliJ IDEA 13: Keyboard shortcuts to navigate stack trace after running tests?

  8. 8

    How to automate running tests before commit in Intellij Idea, without additional software?

  9. 9

    Empty benchmarks when running JMH samples in Intellij IDEA

  10. 10

    Skip tests in IntelliJ using Gradle

  11. 11

    intellij idea 14 and gradle issues when running integTests

  12. 12

    IntelliJ NoClassDefFoundError when running IntelliJ Tests

  13. 13

    Running jest tests directly in Intellij Idea/WebStorm?

  14. 14

    Gradle not running tests

  15. 15

    Intellij IDEA and Gradle projects

  16. 16

    "Address already in use: bind" exception when running Gradle JUnit tests

  17. 17

    Running Spark Unit Tests in IntelliJ

  18. 18

    ActiveMQ in-memory broker not starting when tests running in IntelliJ IDEA

  19. 19

    Set up environment variables for Gradle Runner and JUnit tests on Intellij Idea

  20. 20

    Gradle project running jUnit 5 tests in IntelliJ

  21. 21

    OpenEJB Logger configuration when running tests from TestNG in Intellij IDEA

  22. 22

    Stop debug mode in IntelliJ IDEA when using Gradle

  23. 23

    "No tests found for given includes" when running Gradle tests in IntelliJ IDEA

  24. 24

    Gradle daemon not reused when running in debug mode (in IntelliJ IDEA)

  25. 25

    No tests found for given includes:

  26. 26

    Gradle project running jUnit 5 tests in IntelliJ

  27. 27

    java.lang.ClassNotFoundException when running in IntelliJ IDEA

  28. 28

    IntelliJ IDEA Error Running Application

  29. 29

    Always getting 404 when running Spring Boot Gradle app in IntelliJ

HotTag

Archive