Friday, October 16, 2009

Team Coverage with TestDriven.Net

I’ve been playing with NCover and NCoverExplorer Community Edition recently.  I also look at Team Coverage which is embedded inside Visual Studio 2008.

Rapidly, in understood that only MSTest is supported with Team Coverage.  I know that an add-in exists to support MbUnit tests but I did not look into it.  Actually, I always used TestDriven.Net so I’ve never complained about the fact that VS does not support MbUnit out of the box.

Then I remembered that TestDriven.Net proposed us a list of frameworks and tools to “Test With” in the context menu.  There you’ll find 2 options: Coverage and Team Coverage!

image

I first tried Coverage (with NCover) but the coverage results were empty and I’m not sure what went wrong exactly.  Next I’ve tried Team Coverage…  It worked on the first try, I got the data in the Code Coverage Results pane and code highlighting and everything else I had in NCoverExplorer!

image

From now on I’ll be using this trick when doing unit tests to check if I got it all covered.

Tuesday, October 13, 2009

Adding Resharper’s User File Template in the quick list

I tried to add a new file template for Resharper (shortcut ALT-INS in the solution explorer).  The template was for creating a new test class for MbUnit test framework.  Everything worked fine except that my new file template did not appear in the quick list.

I’ve looked online and found this post on Vadim’s blog, he was doing the exact same template that I was doing!!

Anyway, I’ve tried to call my new template via the Resharper menu and I found this option on one screen:

image image

After that I was able to use my new file template from the quick list (ALT-INS)

image 

I hope I only overlook something because I think this option should be available on the File Template edition screen (or in the Option like it used to be, look at Vadim’s post).

Update!!

After a few days I finally found out the easy (yet not very intuitive) way to modify the quick list.

In the Templates Explorer – File Templates (menu Resharper –> Live Templates…) on the left side is the available templates and on the right side is a preview of the quick list for C#, VB and other project types. 

To add a new template to the quick list simply drag the template on the left and drop it on the right side on the position you want.  To remove a template from the quick list just select it and click the delete button in the toolbar.

image

If you are curious here is my own File Template for MbUnit test fixture class

using System;

using MbUnit.Framework;

namespace $NAMESPACE$
{
[TestFixture]
public sealed class $CLASS$
{
#region Constructor

public $CLASS$()
{
}

#endregion

#region Test Methods

[Test]
public void Test()
{
$END$
}

#endregion
}
}