NCoverExplorer FAQ
The latest version of this document is located here.
For the latest NCoverExplorer news and updates, visit my blog.
This tool allows you to open a coverage.xml file produced by NCover and navigate the source code. The source code is highlighted to clearly show which statements were visited and not visited.
NCoverExplorer has been tested with both NCover 1.3.3 and the latest NCover 1.5.x. In the event of the NCover coverage xml file schema changing drastically in the future an updated release of NCoverExplorer would be required.
Jamie Cansdale now offers a "Test with... Coverage" feature in the latest version of his excellent TestDriven.Net tool. This will automatically launch NCoverExplorer to display the results of running unit test(s) under code coverage with NCover. Note that as of build 1341 TestDriven.Net now works using both the latest version of NCover (1.5.x) and the earlier NCover 1.3.3 version.
My solution I used at work was a combination of NAnt and NAntRunner (the VS.Net add-in) to perform something similar. I have NAnt tasks to:
VSTS features of unit testing and code coverage will only be included with the premium bundles of the Visual Studio product range - and as such will most likely be priced above what many developers and businesses are prepared to pay. For "everyone else" in the market it would seem likely that they will continue to utilise open source alternatives.
Even if you are one of the fortunate developers who can afford VSTS, it still must be measured feature-wise against the open source alternatives which in a lot of cases have now been established for many years. Developers and managers will weigh up for themselves how important those features are as well as other factors such as Microsoft support etc. The nice thing for many of us is that we have a choice...
A number of reasons. At first glance having your code colour coded within the VS.Net IDE may sound great. However think about what we are trying to achieve - improving our test code to increase our coverage. That means in many cases you want to be editing the unit tests themselves, not the pretty coloured code under test. This then requires either a photographic memory or a penchant for continually resizing your IDE/tab groups, as well as an ability to not find the colours distracting while editing and refactoring code... not my first choice.
You may instead find it more convenient to have a separate application window which can be positioned on a second screen (you all have at least two don't you?) or ALT-Tab switched between. As of release 1.2.1 NCoverExplorer allows direct code navigation from method coverage in NCoverExplorer to it's corresponding line in the source code file within the VS.Net IDE.
From a technical perspecitive it is a non-trivial task - particularly if trying to support all the variants of the IDE. To do it natively requires VSIP skills which is a trip to the dark side. I won't say "never" however and if I find some spare time (or you want to volunteer to help me!) then it might happen one day...
The default settings when NCoverExplorer is installed are as follows:
The default settings when NCoverExplorer is installed are as follows:
Depending on your coverage strategy, the code being tested and the extent of your usage of reflection, mock objects and/or dependency injection you may determine it unfeasible to try to reach 100% coverage everywhere. Some teams readily accept the diminishing returns that can apply and instead set a specific blanket coverage goal such as “85%”.
Assuming you have such a situation and there was no threshold capability, you would be stuck forever looking at a "danger red" node in the tree every time you open NCoverExplorer. With this feature enabled (by setting a threshold less than 100% in the View->Options dialog) you see a more calming mellow “blue” instead...
As of release 1.3.1 you can now also specify the tolerance as a number of unvisited lines. If either of the two threshold conditions are met the node will be coloured appropriately. Note that a visit count of zero will always show as uncovered regardless of your tolerance.
Of course just because you exceed the percentage doesn't mean that the 5% of code unvisited isn't the most critical!
Please leave a comment on my blog with the idea and I will see what I can do. NCoverExplorer is not my "day job" so no promises can be made but if the idea is indeed a good one which will benefit many others I'm sure we can find time...
To download NCoverExplorer without TestDriven.Net, you can find it here or on the mirror site here (my thanks to Dave Dustin).
Download it as part of the install with TestDriven.Net from here.
The following shortcuts exist currently:
CTRL+A - Collapse all nodes recursively. CTRL+E - Edit in VS.Net at the current caret position. CTRL+L - Expand all nodes recursively. CTRL+O - Open coverage xml file. CTRL+Q - Expand all covered child nodes. CTRL+S - Save coverage xml file as displayed (without excluded nodes). F2 - Display the options dialog. F3 - Display the statistics summary dialog. F5 - Reload the current source code file. F6 - Display the reports dialog. DEL - Exclude node and children from coverage tree and recalculate coverage. INS - Include node and children into coverage tree and recalculate coverage.
ALT+1 - Filter (hide) all 100% coverage nodes. ALT+2 - Filter (hide) all unvisited (0%) nodes. ALT+0 - Remove all filters.
CTRL+1 - Display sequence point coverage report (covered%). CTRL+2 - Display sequence point coverage report (covered%) (unvisited seqpnt#). CTRL+3 - Display sequence point coverage report (unvisited seqpnt#). CTRL+4 - Display function coverage report (visits).
CTRL+SHIFT+1 - Sort by name (default). CTRL+SHIFT+2 - Sort by name down to class level, with methods sorted by line number. CTRL+SHIFT+3 - Sort by coverage percentage ascending. CTRL+SHIFT+4 - Sort by coverage percentage ascending. CTRL+SHIFT+5 - Sort by #unvisited sequence points ascending. CTRL+SHIFT+6 - Sort by #unvisited sequence points ascending. CTRL+SHIFT+7 - Sort by max function visit count ascending. CTRL+SHIFT+8 - Sort by max function visit count ascending.
C:\Documents and Settings\[User Name]\Application Data\KiwiDevelopment\NCoverExplorer\NCoverExplorer.config
A zip file containing the task source code, compiled assemblies and examples can be found here
---------------------------------
FAQ last updated Apr 2nd 2006.