Browsing Posts in .NET Tools

Over the past few months, I’ve been doing test-driven development (TDD) using VstsUnit (aka MSTest), which ships with Visual Studio Team System. (A client’s choice to use VstsUnit, not mine.) I’m an avid ReSharper user and quite like their unit test runner, which allows you to run NUnit or csUnit tests directly from within Visual Studio. Unfortunately it doesn’t support VstsUnit. When Albert Weinert released MbUnit support for ReSharper a few months back, I realized that JetBrains had an undocumented plugin model for their unit test runner and I could integrate support for VstsUnit into ReSharper. Without further ado, I present to you the VstsUnit Plugin for ReSharper.

VstsUnit Plugin for ReSharper

Out of the box, JetBrains ReSharper Unit Test Runner supports NUnit and csUnit. This ReSharper plugin adds support for the Unit Testing Framework in Visual Studio Team System (VstsUnit), also known as MSTest.

N.B. The plugin will likely work with JetBrains UnitRun, but I have not taken the time to test it with UnitRun. Unfortunately you cannot have ReSharper and UnitRun installed at the same time, which means I need to set up a virtual machine with Visual Studio 2005 and JetBrains UnitRun. I have not taken the time to do this yet.

Installation

  1. Close Visual Studio 2005.
  2. Extract the contents of archive, including the VstsUnit folder, to:
    %ProgramFiles%\JetBrains\ReSharper\VS2005\Plugins
  3. Launch Visual Studio 2005.
  4. Open a project containing VstsUnit tests.
  5. Open a test file containing a TestClass with TestMethods. Standard ReSharper icons will appear in the left margin and allow you to run the unit tests.

Known Issues

ReSharper Unit Test Runner icons do not appear beside TestClass and TestMethod.
This is typically caused by having an assembly reference to another unit test framework. ReSharper Unit Test Runner (and UnitRun) only support a single unit test framework per test assembly. Remove references to NUnit.Framework, csUnit, and/or MbUnit.Framework from the References in your test project. This is a known limitation in the JetBrains’ current unit test runner implementation. A plugin votes on whether the current assembly contains tests that it can run. If the plugin votes “yes”, the unit test runner stops querying additional plugins. NUnit and csUnit get queried before third-party plugins.
Poor performance when running full test suite.
Unit tests are run by invoking mstest.exe and parsing the resulting XML file (.trx). The Unit Test Runner invokes the plugin once for every TestClass (aka TestFixture in NUnit terms). Unfortunately MSTest has high overhead as it copies all files to a new directory to execute tests. There is no way to turn off this behaviour in MSTest. It may be possible to run the full suite of tests and cache the results, but there are numerous problems with this approach including determining whether the cache is fresh and keeping TestClass or TestMethod runs responsive. Due to the architecture of MSTest, it is not possible (without what would likely be some truly awful System.Reflection work) to run the unit tests in-process as is done for NUnit and csUnit.
Cannot debug or profile VstsUnit tests.
I have not found a way to hook the debugger or profiler to the MSTest process. Hopefully this will be possible in a future version.

This post by S. Somasegar, VP of Microsoft’s Developer Division, stirred up quite a racket back in September about incompatibilities in VS2005 on Windows Vista. Now that I’ve had a chance to use VS2005 on Vista seriously for a few weeks, I can say that it’s much ado about nothing. VS2005 is a complex application. Does it run on Vista? Yes. Does it run as a limited user or a filtered administrator*? Yes. Are there problems? Yes. Are they show-stoppers? Not for the most part. Full details, including broken features, can be found here on MSDN. If you’re depending on one of these features, life sucks. For most developers, it will mean the occasional visual glitch. I’ve had this happen once and a simple refresh of the Visual Studio window resolved it.

In a way, I can understand where the DevDiv is coming from. VS2005 is in the support channel now and they’re actively working on “Orcas” or Visual Studio vNext. Orcas is the development tool designed to target Vista and .NET 3.0. You’ll notice that all the .NET 3.0 designers are CTPs. They’re works in progress and destined for Orcas as their final home. (I don’t know if VS2005-compatible versions will also be available.) The unfortunate part is that the most likely early adopters of Vista are developers and the DevDiv doesn’t have a fully-supported tool for the platform. Now that sucks. Microsoft has built mind-share by creating a fantastic platform for developers. Developers are a bit out in the cold when it comes to Vista and .NET 3.0. Imagine releasing .NET 2.0 without VS2005? On the one hand, Microsoft should have coordinated th release of Orcas with Vista. On the other hand, by the time most developers will be looking at Vista, Orcas will be released. It’s only us early adopters that need to brave the excitement of running an unsupported developer tool on the latest version of Microsoft’s flagship OS. Honestly, it’s not all that exciting. For the most part, VS2005 works as it always has with a few rough edges due to UAC.

* A filtered administrator is an administrator whose admin token has had most of its privileges stripped out and the Administrators’ group SID changed to a deny. The real admin token is kept in waiting, heavily protected, and is activated when the user clicks “Continue” on a UAC prompt. A good review of the details can be found here on Márton Anka’s weblog. He also has some good information on how to declaratively and programmatically request an elevation of privilege. (i.e. Throw up the UAC prompt.)

The Edmonton Code Camp was a blast. John Bristowe and I drove up Saturday morning and returned late Saturday night. There were lots of action packed presentations throughout the day, but Jean-Paul Boodhoo stole the show as per usual. His presentation on cool things you can do with generics was excellent and there was not a PowerPoint slide to be seen. It was a nice contrast to my PowerPoint-heavy Tools of the Trade: Must-Have .NET Utilities (PowerPoint 2007 slidedeck), which was on right before. (Maybe I’ll try doing that presentation without the PowerPoint crutch next time.)  Thanks to everyone who came to my talk and especially those who asked questions. To save people from having to download the slidedeck just to get the links, here is the tools that I talked about in raw, unadulterated HTML:

The Holy Trinity

Source Control

Code Analysis Tools – Static

Code Analysis Tools – Dynamic

Build Tools

  • CruiseControl .NET (http://ccnet.thoughtworks.com/)
    • Continuous integration server Builds via NAnt, MSBuild, DevEnv, or custom
    • Runs unit testing (NUnit), coverage (NCover) and/or code analysis (FxCop) on builds (optional)
    • Reports build and/or test failures via email
    • Dashboard (ASP.NET app) shows current and past build status

Debugging Tools

Coding Tools

CopySourceAsHtml is a godsend for those developers who need to display source code in HTML format. (Blogs, online documentation, and developer forums all come to mind as reasons you need to display code as well-formated HTML.) A version compatible with VS 2005 was just released. To understand why you need this VS add-in, take a look at Hello World as copied and pasted using Edit… Copy… Paste…

using System;

namespace JamesKovacs.Examples {
    /// <summary>
    /// Summary description for HelloWorld
    /// </summary>
    static class HelloWorld {
        public static void Main() {
            Console.WriteLine(“Hello, World!”);
        }
    }
}

With CSAH, you get:

using System;

 

namespace JamesKovacs.Examples {

    /// <summary>

    /// Summary description for HelloWorld

    /// </summary>

    static class HelloWorld {

        public static void Main() {

            Console.WriteLine(“Hello, World!”);

        }

    }

}

CSAH is highly configurable with options to display line numbers, change fonts, override tab size, etc. If you have Consolas installed on your system, the above code snippet will be displayed in it. Otherwise, I configured a fallback to Courier then sans-serif by overriding the font list. (If you don’t override it, it uses whatever your current editor font is set to.) Awesome VS add-in!!!

Lutz Roeder just released Reflector 4.2. (For those of you who haven’t heard me blither about Reflector I’ll say it again… Reflector is one of the best .NET utilities available. It gets installed shortly after Visual Studio after I build a dev box.) Lutz lists off the list of fixes as “Web Proxy support, String search, Fonts, Generics fixes.” (No, I’m not paraphrasing. This is the complete change log.) You can get the latest by launching Reflector and then selecting Help… Check for Updates. You can also grab it from here.


WARNING!!! If you use any cool Reflector add-ins*, such as Diff, FileDisassembler, or SQL2005Browser, you’ll have to wait until the respective authors re-compile for Reflector 4.2 because they will fail to load. (Breaking changes were made to Reflector’s object model in Reflector 4.2.) Unfortunately you can’t roll back a Reflector upgrade unless you squirreled the old installer away somewhere (which of course I didn’t because I’ve been upgrading via Help… Check for Updates). Oh well. Some folks, such as Herve Chapalain, author of Reflector.CodeSearch, already have a version of their add-in that is compatible with Reflector 4.2.


* Lutz maintains a list of Reflector add-ins here. Reflector SDK for building add-ins can be found here.


UPDATE: Diff v0.75 was just recompiled to work with Reflector 4.2.

The Calgary .NET User Group will be hosting Joel Semuniuk, Regional Director, MVP, and VSTS Blackbelt* on Wednesday, January 25, 2006 from 5 to 8pm where he will be talking about… drum roll please… VSTS. (Bet you guessed that, didn’t you?) The event is generously being sponsored by Allstream. Pre-registration is required and available on the Calgary .NET User Group website. Hope to see you there!


* OK, I made the last one up, but seriously, Joel is the most knowledgeable VSTS guy around outside Redmond.

Good news from Charlie Poole and the NUnit team… NUnit is Ready to Rock. NUnit Iteration Relase 2.2.3 is out and is compatible with .NET 2.0 and VS 2005! You no longer have to download latest and compile it yourself to run with .NET 2.0. Go check out the release notes for what they’ve added in addition to .NET 2.0 support. You’ll have to go grab it directly from SourceForge.net here as the NUnit download page hasn’t been updated yet with a link to the 2.2.3 release.

For those of who prefer an integrated unit testing experience, I’ve been successfully using TestDriven.NET 2.0 Beta for running NUnit tests inside VS 2005. You can grab it from Jamie Cansdale’s FolderShare.

Now that VS 2005 and .NET 2.0 has been released, the torrential flow of tool updates to .NET 2.0 has started. Some of my favourite .NET tools have been updated to .NET 2.0:

I’m anxiously awaiting the next version TestDriven.NET, too. A beta of v2.0 is available for those who want to try it.
 
An interesting add-in for .NET Reflector is SQL 2005 Assembly Browser by Denis Bauer. It allows you to browse .NET assemblies stored in SQL Server 2005. This is something I’m definitely going to investigate more thoroughly.
 
In related news, WSE 3.0 just RTMed!!! This is great news because WSE 3.0 will be wire-compatible with Indigo — uhm, I mean Windows Communication Foundation (WCF). This gives us a good migration story to Microsoft’s next generation distributed communication platform.
 
And somehow I also missed the fact that the coding superhero, Lutz Roeder, has a blog for a number of years, even if it is rather sparse. Subscribed.

After months of preparation and much secrecy, Plumbers @ Work has been released into the wild by the .NET Plumbers. The regular podcast is part of MSDN Canada Radio and will be featuring John Bristowe, Dan Sellers, Bil Simser and myself. We’ll be talking about current and upcoming developments in .NET and Microsoft technologies. Our inaugaural episode will discuss hot topics like:

  • Introducing the podcast
  • VS 2005/SQL 2005/BizTalk 2006 - Here they come!
  • SharePoint vNow and vNext
  • Drinking from the .NET 2.0 firehose
  • Half-time show
  • Security – It’s a process not a technology
  • Developing as a non-admin
  • Microsoft hardware
  • A walk down memory lane with Microsoft Bob
  • Xbox 360 – Should I get one?

Without further ado, I present to you:

Plumbers @ Work – Episode 1 – Mostly Harmless

You can catch the RSS feed here. You can leave us feedback and suggestions on the podcasts at .NET Plumbers.

Hot off the presses from Somasegar, Microsoft just shipped Visual Studio 2005 and .NET Framework 2.0!!! This is a huge release and a great accomplishment for Microsoft. We haven’t seen this much goodness since .NET Framework 1.0 was released. Congratulations to everyone who has been involved in making this happen.


Grab the RTM bits while they’re still hot if you can. Microsoft Subscriber Downloads seems to be under a DDoS attack of their own making as every MSDN subscriber on the planet tries to grab the latest.