Is there a way to run all test in an root pom and collect test coverage in Intellij Idea ?

有帮助吗?

解决方案

Create a Run Configuration that will look for tests in the whole project. Make sure that you choose All in package and In whole project in the configurations dialog:

enter image description here

Make sure that you choose the <default> package in the Choose Package dialog.

enter image description here

Now you can select to run this configuration using Run 'All in project' with Coverage:

enter image description here

The result will be presented in a separate coverate window:

enter image description here

And you will also see the result in the Project View window for a fast overview:

enter image description here

其他提示

Right click on the parent module (root pom), and select Run 'All Tests' with Coverage.

enter image description here

There is a 'Coverage' plugin, which may not be enabled by default.

Find it at File->Settings->Plugins.

This will enable the 'Run with Coverage' buttons and menu items.

A short official overview video is here: Code Coverage by IntelliJ IDEA

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top