“Test events were not received” when run tests using Intellij

前端 未结 13 2227
花落未央
花落未央 2021-02-06 21:11

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

相关标签:
13条回答
  • 2021-02-06 21:29

    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.

    0 讨论(0)
  • 2021-02-06 21:29

    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()
    }
    
    0 讨论(0)
  • 2021-02-06 21:29

    In my case I had an invalid Gradle JVM configuration (configured jdk was removed from filesystem).

    To Fix it had to change Gradle JVM on File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JVM.

    It was red due to an invalid JDK path.

    IntelliJ version: 2019.2.3

    0 讨论(0)
  • 2021-02-06 21:30

    For me, this is helpful to click "Help -> Check for Updates..."

    Help -> Check for Updates...

    0 讨论(0)
  • 2021-02-06 21:36

    For anyone that is still facing this -
    check if you have any compiler errors in the Build tab.

    0 讨论(0)
  • 2021-02-06 21:36

    The problem occurred as I used both following plugins at the same time

    plugins
    {
      id 'org.springframework.boot' version '2.2.6.RELEASE'
      id 'io.spring.dependency-management' version '1.0.7.RELEASE'
      ...
    }
    

    after deletion of the second one, the tests were found and executed.

    0 讨论(0)
提交回复
热议问题