I'm using IDEA in order to analyze our code coverage. I can see that some lines were called N number of times. But I also want to know which test caused that line call. I see the appropriate button "Show tests covering line", but this button is disabled for all of the lines.
So what is the reason of that behavior and is it possible to force IDEA to show tests which called a particular line of the code
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.
You simply take: (A) the total lines of code in the piece of software you are testing, and. (B) the number of lines of code all test cases currently execute, and. Find (B divided by A) multiplied by 100 – this will be your test coverage %.
To enable code coverage highlighting In the IDEA IDE, on the Analyze menu, click Show Code Coverage Data, or use the Ctrl+Alt+F6 keyboard shortcut.
From the docs:
This button is only available in the Tracing mode, and with the Track per test coverage check box selected
You can enable tracing and 'track test per coverage' in the Run/Debug window. Here's a screenshot:
More details in the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With