Kiwidude's Geek Spot
Ramblings about NCoverExplorer, .Net development and other geek toys
Saturday, March 18, 2006
Thursday, March 16, 2006
HTML Coverage Reporting
I've had a couple of users ask whether NCoverExplorer might ever offer the ability to generate HTML reports of code coverage. An example of the potential sort of output (including the source code highlighted) is shown by Clover.
I'm interested to know just how much demand there is for this feature. It looks pretty but personally I doubt I would make use of this particular report - html pages by their nature are static and the hundreds or thousands of pages generated are virtually guaranteed to be out of date immediately as the code changes. I'm open to being educated though - what usage would you make of such a feature if NCoverExplorer offered it, or is it just a "nice to have"?
The one type of reporting I have found useful is the top summary section produced by the coverage.xsl that comes with NCover. The downside of the XSL approach is it is just way too slow on large coverage files. It could be fairly easy for NCoverExplorer instead to produce a static HTML summary page showing the graph percentages. This report could then be included as a CruiseControl build artifact (if I make a console driven NCoverExplorer version) or via e-mail.
Does this have any appeal? If so, what sort of reports would you like to see (e.g. assembly coverage summary only or namespace/class summary). How detailed and customisable do the report(s) need to be?
All input for and against welcomed - either in the blog comments, or post your thoughts in the TestDriven.Net users group in this thread.
Filed in: ncoverexplorer
Tuesday, March 14, 2006
Plenty of "must have" features that have been on people's wish lists in this release and a couple of irritating bugs fixed so I can't recommend highly enough that people upgrade. Download details at the bottom of the post.
Merging coverage files is the first of the "killer" features, offering improved integration with TestDriven.Net. Some of you may have noticed the inability to produce coverage results across a VS.Net solution or with multiple fixtures selected in the solution explorer window. The latest release of TestDriven.Net now supplies multiple coverage file names to NCoverExplorer which will merge and present the consolidated results. You can also manually merge multiple coverage files within NCoverExplorer via a number of ways, such as a "File->Merge" menu option or drag/drop.
Saving of the consolidated coverage results is now possible using the new "File->Save/Save As" options. Note that saving will remove any excluded nodes (see below) and merges together any duplicated visit count sections from the new coverage.xml file. This means you will likely find the resulting file much smaller than the originals.
Coverage exclusions are my personal favourite new feature. This offers a way for NCoverExplorer to automatically remove from the coverage tree items not relevant to your analysis when a coverage file is loaded - such as unit test fixtures, third party libraries etc. In the screenshot shown you can see the default exclusions I have included with NCoverExplorer - for instance any assemblies ending in ".Tests" will be excluded. You can add exclusions at the class, assembly and namespace level. I have also added support for the NCover 1.5.x feature of "exclusion attributes" if they exist in the coverage.xml file (although NCover still has some kinks to be worked out in a future release before you can rely on this feature).
All excluded items are then added to a special Excluded bin for the parent node as shown in the screenshot below. The source code for excluded methods will be highlighted in grey. You can also manually exclude items on the fly via a right-click "Exclude from Results" menu which replaces the previous "Remove from Results" option.
Source code tabs started out as a solution to a problem a few users reported with highlighting, particularly to do with partial classes. I believe I have resolved this once and for all now with the introduction of this feature. If you click on a partial class in the coverage tree, a tab is opened for every source code file making up that class with all the code highlighted as shown here.
The tabs also offer a way of quickly navigating around the coverage tree as selecting a tab will select the corresponding class node.
Themes came about as an answer to another much requested feature of more customisation of the GUI to include fonts and background colours. A "theme" is a group of settings covering most aspects of the appearance of the coverage tree, statistics pane and source code highlighting.
You can of course add your own themes as shown in the screenshots on this blog entry. Themes are easily toggled between using the new View->Themes menu.
Sorting and Coverage options came from a couple of user feature requests as shown here.
These allow NCoverExplorer to display function coverage or focus on methods with the most unvisited code.
My thanks to Trevor Hall for his time taken to suggest and test not only these features but also a number of others slated for a future release (after I take a break!).
Thanks also to Jamie and others who have been kind enough to test the beta versions and provide invaluable feedback.
There are numerous other minor usability tweaks and enhancements I haven't mentioned here that you can read about in the release notes or discover for yourselves. I look forward to any feedback!
Download TestDriven.Net 2.0.1545 combined install
Download the latest NCoverExplorer versions from here.
Friday, March 03, 2006
NCoverExplorer... Partial Classes Grief
I've had a couple of reports of issues with NCoverExplorer when used with partial classes. Thanks to Matthias Paetzold with his excellent repro I've figured out the cause.
You should only be experiencing this particular issue if you split your class variable declarations (with initial value assignments inline) into a different partial class file from that containing a constructor.
NCover groups all those lines of code together for each constructor - in effect creating something I call "partial methods" (that's not exactly the first words I used when I saw this issue but you get the idea!)
I'm hoping to get a fix in my NCoverExplorer 1.3.2 release out early next week to coincide with another TestDriven.Net public beta from Jamie. There's plenty of new NCoverExplorer features including:
- coverage exclusions - automatically remove test assemblies/classes when a coverage file is loaded;
- themes - greater GUI customisation and ability to save your own appearance combinations;
- alternate display options - such as #unvisited sequence points or function coverage;
- tree sorting capability - by coverage, unvisited sequence points etc;