Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Idea : view test coverage on a maven project

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

like image 207
StKiller Avatar asked Jun 19 '13 10:06

StKiller


People also ask

How do I show test coverage in IntelliJ?

Coverage in the Coverage tool window If you want to reopen the Coverage tool window, select Run | Show Code Coverage Data from the main menu, or press Ctrl+Alt+F6 . The report shows the percentage of the code that has been executed or covered by tests.

Why test coverage is not showing in IntelliJ?

From the main menu, select Run | Show Coverage Data ( Ctrl+Alt+F6 ). In the Choose Coverage Suite to Display dialog, select the checkboxes next to the necessary suites, and click Show selected. IntelliJ IDEA opens the coverage results for the selected test suites.

How do you show test coverage?

How to Calculate Test Coverage. Calculating test coverage is actually fairly easy. You can simply take the number of lines that are covered by a test (any kind of test, across your whole testing strategy) and divide by the total number of lines in your application.


1 Answers

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

like image 98
maba Avatar answered Sep 28 '22 01:09

maba