Recently we’ve had a flurry of customers wanting the ability to compare the code coverage of their application.
This sounded like a good idea so we asked these customers why they wanted to be able to compare different code coverage runs. The answers were varied:
- I want to be able to take a known good baseline and compare it to a run with a regression in it.
- I’ve inherited a legacy application and we want to understand the code paths for each given test.
- I’ve inherited a legacy application and we know nothing about it. We’re testing it with appropriate input data and want to see which code executes.
For these customers being able to compare their code coverage runs is a big deal. Being able to compare your code coverage visually rather than just know that Session A is better than Session B allows you to quickly and easily identify exactly the area to focus on. It was such a compelling idea we’ve implemented code coverage comparison for all versions of Coverage Validator. This results in changes to the Session Manager and some new user interfaces.
Session Manager Dialog
The Session Manager has an additional Compare… button which will display the Session Comparison dialog.
Session Comparison Dialog
The Session Comparison allows you to choose two sessions and then view the comparisons. Clicking the Compare… button will display the Code Coverage Comparison viewer.
Code Coverage Comparison Viewer
The code coverage comparison viewer is split into two parts, separated by a splitter control. The top part lists each file that is in each session being compared. The bottom part displays the source code coverage for the baseline session and for the comparison session. You can choose to view all code coverage data for these files or to only view the files that are different between baseline and comparison sessions.
You can compare different executables if that makes sense – for people testing related unit tests this can be a valid thing to do.
The display automatically selects the first file that contains code coverage differences and displays the baseline and comparison files in the bottom window at the location of the first difference in the file. As with our other code coverage displays the source code is highlighted to indicate which lines are visited/not visited and annotated so that you can determine line numbers and visit counts.