November 2006 - Posts

Testing With NCover/NCoverExplorer

The following screencast demonstrates how to achieve 100% coverage using TestDriven.NET 2.0, NCover and NCoverExplorer. Peter Waldschmidt and Grant Drake very kindly agreed to let me distribute NCover and NCoverExplorer with the RTM version of TestDriven.NET 2.0. This means that once TestDriven.NET is installed, there is nothing more to configure. Code coverage with NCover can be used from Visual Studio .NET 2002, 2003 or 2005. It is possible to use NCover if only .NET 1.1 is installed, however .NET 2.0 is recommended. If only .NET 1.1 is installed then NCover 1.3.3 will be used rather than the more mature NCover 1.5.6.

In the screencast I start off by showing how to zoom in on the partially covered regions of code. I then navigate back to Visual Studio and expand my unit test to cover all of the partially covered method. Rather than create a unit test for the ToString method, I decide to use the 'Coverage Exclude' feature of NCover 1.5 (TestDriven.NET uses "//ea CoverageExcludeAttribute" by default). I create a new CoverageExcludeAttribute and use it on the ToString method (extra assembly references are required). This enables me to achieve 100% coverage with the excluded code grayed out and not counted in the final coverage score.

 

You can watch the screencast here.

I'd like to thank Grant Drake in particular for his support, generosity and convincing me that it was worth carrying on with the project. :-)

Sysinternals Process Monitor v1.0

Here's an announcement that I almost missed due to the noise from TechEd and the Sysinternals site migration. The long awaited replacement for Filemon and Regmon has been released! Process Monitor adds process, thread, and DLL monitoring as well as advanced filtering and event information.

Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity. It combines the features of two legacy Sysinternals utilities, Filemon and Regmon, and adds an extensive list of enhancements including rich and non-destructive filtering, comprehensive event properties such session IDs and user names, reliable process information, full thread stacks with integrated symbol support for each operation, simultaneous logging to a file, and much more. Its uniquely powerful features will make Process Monitor a core utility in your system troubleshooting and malware hunting toolkit.

Process Monitor runs on Windows 2000 SP4 with Update Rollup 1, Windows XP SP2, Windows Server 2003 SP1, and Windows Vista as well as x64 versions of Windows XP, Windows Server 2003 SP1 and Windows Vista.

You can see below how the registry and file monitoring functionality has been combined into a single view and new process and thread monitoring added.

There is a new Microsoftified site and blog. Apparently everything has been migrated over except the source code.

As DisappointedOne points out:

On the 'Oh my, used in malware, cut it, cut it!!!' issue: The only thing you'll accomplish will be to have all those sources floating around on hacker sites, file sharing networks and the like. Many people who could do something useful with them may not be bothered to search for them in those places, but malware authors most certainly will. Who's losing and who's gaining, I wonder?

The other comments are worth reading as well.

Posted by Jamie Cansdale | with no comments
Filed under:

Driving MSTest and Team Coverage using TestDriven.NET

Here is a screencast that demonstrates the MSTest and Team Coverage integration in TestDriven.NET 2.0. The testing support that comes with Visual Studio 2005 Team editions was designed to support many different types of test. For example is supports manual tests, integration tests, generic tests as well as unit tests. The interface for TestDriven.NET is tuned specifically for doing unit testing and test driven development. By combining the two you can execute unit tests written using Microsoft's framework in a way that is more efficient for doing TDD.

For a longer explanation I recommend you read Brian Button's post on:
Real Test Driven Development with Visual Studio Team System

 

You can watch the screencast here.

Happy Anniversary Express SKU!

Dan Fernandez writes:

One year ago today, Steve Ballmer was on-stage announcing our official launch of Visual Studio Express to the world...it seems like just yesterday!  Since launch, we've had over 6.8 million completed Express downloads!

I've been a fan of C# Express since it was first launched in beta. In fact I have been developing TestDriven.NET using C# Express since the days of NUnitAddIn. Here are the release notes from NUnitAddIn-0.9.576.

Posted August 20, 2004 (over 2 years ago):

Hopefully this puts my reluctance to drop Express SKU support into context. Microsoft you shafted me.

Test With .NET 1.1 from Visual Studio 2005

Here is a screencast that demonstrates how to build and run tests using .NET 1.1 from inside Visual Studio 2005 using TestDriven.NET 2.0. Under the covers this functionality uses MSBee (MSBuild Extras Toolkit for .NET 1.1) to build target assemblies that are compatible with .NET 1.1. Any build errors and warnings are merged into the 'Error List'. After the solution is built, the target tests are executed using the .NET 1.1 runtime.

  

You can find the screencast here.

I'd like to thank Craig Lichtenstein for me giving lots of useful feedback as this feature was being developed. Craig used to work on MSBee when he was part of the devdiv developer solutions team.

Debug With Reflector

Below are a few frames from a screencast that shows how to debug an application using the new 'Go To Reflector' functionality in TestDriven.NET 2.0. I'm using Grant Drake's NCoverExplorer as a target for the debugger. Once attached I use Reflector to view one of the loaded modules. I then set a breakpoint on the AboutDialog's OnLoad method.

The first time I open the dialog the Visual Studio 2005 debugger option Just My Code is enabled (the default). I am showing this because you will probably forget to disable this feature at least once and wonder why breakpoints are not being hit. You can find this setting under 'Options\Debugging'. Once I uncheck this setting the breakpoint is hit and I'm able to step through the x86 code. You can see me using 'Go To Reflector' on the 'Dissasembly' and 'Call Stack' windows.

 

You can watch the screencast here.

More Posts