Intellij IDEA单元测试时报Test events were not received

时间:2024-05-22 16:35:55

最近用Intellij IDEA 2019.2.3反复跑单元测试的时候,单元测试没有运行,抛出一个Test events were not received的信息,看了一下运行单元测试的命令竟然是gradle :project-name:cleanTest :project-name:test --tests "some.class.some.method"

查了一下,Intellij IDEA从2019.2.1版本开始,会将Gradle管理的项目的测试代码,默认使用Gradle来运行,从Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle进入,可以看到:

Intellij IDEA单元测试时报Test events were not received

Run tests using: Gradle中的Gradle修改为Intellij IDEA,接下来到Run/Debug Configurations中,把Gradle下的各种test删掉,重新跑就一切正常了

Intellij IDEA单元测试时报Test events were not received