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. You can filter, sort and report on the coverage results.
NCoverExplorer as of version 1.3.4 requires either .NET 1.1 or .Net 2.0 (it is compiled against .Net 1.1).
NCoverExplorer has been tested with both NCover 1.3.3 and up to the latest NCover 1.5.7. It will NOT work with NCover 1.4.6. Note that NCover 1.5.x only works with .NET 2.0 and requires at least NCoverExplorer 1.3.5 and/or a TestDriven.Net build > 2.0.1786 due to a limitation in NCover or else you will get duplicate nodes in your coverage results.
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:
As of NCoverExplorer 1.3.5 you now have another option. There is now an included GUI for running NCover directly from within NCoverExplorer and displaying the results.
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...
We have had a number of people e-mail us and say they prefer TestDriven.Net and NCoverExplorer over the VSTS alternative and want to switch off the VSTS ability - that's rather gratifying from our perspective!
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.3.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 perspective an add-in is a non-trivial task - particularly if trying to support all the variants of the VS.Net 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 or in the NCoverExplorer forums and I will see what I can do. NCoverExplorer is by no means 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 I can find time...
To download NCoverExplorer without TestDriven.Net, you can find it here.
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+F - Display the Find Class dialog. CTRL+L - Expand all nodes recursively. CTRL+N - Run NCover (via configuration dialog). CTRL+O - Open coverage xml file. CTRL+P - Print current source code class file. CTRL+Q - Expand all covered child nodes. CTRL+S - Save coverage xml file as displayed (without excluded nodes). F2 - Display the options dialog. F4 - 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+3 - Filter (hide) all nodes exceeding satisfactory coverage threshold. 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+5 - Display function coverage coverage report (covered%). CTRL+6 - Display function coverage coverage report (covered%) (unvisited function#). CTRL+7 - Display function coverage coverage report (unvisited function#).
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. CTRL+SHIFT+9 - Sort by max function coverage percentage ascending. CTRL+SHIFT+0 - Sort by max function coverage percentage descending.
ALT+RIGHT - Next unvisited line in the current class. ALT+LEFT - Previous unvisited line in the current class. ALT+UP - Next unvisited class in the current namespace. ALT+DOWN - Previous unvisited class in the current namespace.
C:\Documents and Settings\[User Name]\Application Data\KiwiNova\NCoverExplorer\NCoverExplorer.config
A zip file containing the task source code, compiled assemblies and examples can be found here
NCover 1.4.6 has a bug whereby the filenames that it writes into the xml file contain undesirable characters. Please use either NCover 1.3.3 or NCover 1.5.x. For more details refer to this blog entry here
One user reported a bizarre issue where on their machines a simple int.Parse("0") would not work. The exact cause is unknown (they had uninstalled some components from their XP installation), however switching region settings to something else and back again resolved the issue.
The module names included in the module thresholds should not include any path information, and are currently case sensitive (must exactly match the module names you see on the NCoverExplorer report). The case sensitivity constraint is fixed in NCoverExplorer 1.3.5.
---------------------------------
FAQ last updated Jul 21st 2007.