"Test events were not received" when run tests using Intellij

I have a Kotlin project and when I run my JUnit tests, I can't see tests execution result in IntelliJ and get this message instead:

test events were not received

I'm using this setup:

macOS Mojave

Intellij CE 2019.2

JDK 11.0.3

Kotlin 1.3.50

Gradle 5.2.1

JUnit 4.12

Can you help me?


Solution 1:

For me, the Same issue was occurring, below changes worked for me. IntelliJ Version I am using: 2019.2.2
In IntelliJ IDE, Go to

File -> Settings ->Build,Execution, Deployment -> Build Tools -> Gradle

here in the Run test using: dropdown selected option was: Gradle(default) changed it to IntelliJ IDEA

Solution 2:

Update to 2019.2.2 or later, which contains the fix for the related issue.

A workaround is to run the tests using IntelliJ IDEA instead of Gradle by changing the delegation option.

Solution 3:

When trying to work out this problem for myself, I discovered JUnit 4 worked, but JUnit 5 reports "Tests were not received." Per petrikainulainen.net I found my solution.

Even though Gradle 4.6 (and obviously all newer versions) has a native support for JUnit 5, this support is not enabled by default. If we want to enable it, we have to ensure that the test task uses JUnit 5 instead of JUnit 4.

When I added the following code to Gradle, JUnit 5 worked.

test {
    useJUnitPlatform()
}