简体   繁体   中英

IntelliJ IDEA Test Coverage window doesn't show

I'm using Spring Boot project with the last version of IntelliJ IDEA (2018.2.1 Ultimate Edition).

When I run all my test with coverage the Coverage window doesn't show, and there's no percentage beside my main classes.

I've tried enabling the coverage window by going to View -> Tool Windows -> Coverage , but the coverage tab is disabled (not clickable).

在此处输入图像描述

If I remember correctly the coverage was working fine before I update IntelliJ. Is that a bug with the last version?

Edit
the coverage plugin is already installed
在此处输入图像描述

Potentially the Coverage plugin is installed but disabled on your machine eg IntelliJ wasn't restarted after plugin was enabled. Try restarting after double checking that Coverage plugin is enabled. As per IntelliJ Code Coverage docs :

Prerequisite

Make sure the Code Coverage plugin is enabled. The plugin is activated by default. If the plugin is disabled, enable it on the Plugins settings page as described in Managing Plugins. If the plugin is disabled, the code coverage tabs will not be visible in the run/debug configuration dialogs.

Try opening Settings > Build, Execution, Deployment > Coverage and check the "Activate Coverage View" checkbox. After that run another test with Coverage.

It's not a problem with JDK or latest version of IntelliJ.

Here is the step you follow and see the coverage window. Run project with coverage, sometimes coverage window not shown if you are unable to see coverage window then

  • press shift+f9
  • then press on stop and rerun

After this, your coverage window is shown.

Still, if you are unable to see coverage window then please double check is coverage view enable or not follow these steps:

  • press ctrl+alt+s
  • extend build, execution and deployment
  • press coverage
  • select first radio box and activate coverage view
  • press apply and then ok

Again follow the above step run with coverage, press shift+f9 etc.

Hope this help.

尝试去

Run-->edit configurations-->select code coverage ( then you can select IDEA/EMMA/...)

I am not sure whether you have figured the solution till date but I ran with the same issue and got solved.

In my case, the issue was with coverage jars were not able to pick up due to spaces on the directory name.

Please follow below thread and let me know if it helps.

Intellij Coverage not working

Thanks.

The package of the classes was the issue for me. The test class and the source class should have same package path

For example-

If the code is in the package: *src.main.* com.company.domain.module test class should also be in *src.test.* com.company.domain.module

You can either rename your packages

OR

If you don't want to rename your packages, then try this

Modify run configurations -> Code Coverage -> You will see the path of test class there. Add your source classes path also.

For me, I verified all the settings in Intellij and all were correct. My test class was in the wrong package due to which Intellij was not showing the coverage.

If the code is in the package: com.company.domain.module test class should also be in com.company.domain.module

Once I corrected the package, the coverage started appearing.

In case anyone is looking for the same issue, I found the option in More Run/Debug section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM