« Agile Conference in Toronto | Main | Simple Design & Testing Conference »

August 20, 2008

Support Visual Studio Test Runner

We started investigating adding support for running tests with Visual Studio’s built-in test runner. It would require Visual Studio 2008 SP1, and would require Professional edition or higher.

In order to support running xUnit.net tests in Visual Studio, we discovered that the project needs to be marked as one of Visual Studio’s Test projects (essentially, it’s a C#/VB.NET project that has extra bits inside it that tell Visual Studio the project contains tests). Projects which are marked this way cannot be opened in versions of Visual Studio that do not have unit testing support installed (this includes Standard and Express editions, which do not offer unit testing, as well as any user who opts not to install the unit testing support).

Practically speaking, this causes the following to be true:

  • You must have a separate project for tests. You cannot place your tests inside your main project.
  • If you have an existing project with tests in it, you need to edit the .csproj file to add the extra bits into it. (You can also start over with a new project and port the code, but hand editing the .csproj seems easier and more success-prone.)
  • If you create a new Unit Test project, you will need to remember to remove any references to the Visual Studio Test DLLs, since these will not be present unless Visual Studio is installed (for example, on your continuous integration server).
  • If you forget to change the project type, the support simply won’t work. There will not be any feedback as to why; the tests simply won’t show up in Visual Studios Test views.
  • If your project is consumed by many users with various versions of Visual Studio (for example, if you’re running an open source project), you are more likely to run into the version limitations than if you’re using xUnit.net for an internal project with a consistent developer platform.

Given this context, if you have an opinion about how to proceed could you voice your opinion here.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8354604d653ef00e554154b478834

Listed below are links to weblogs that reference Support Visual Studio Test Runner:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Hi James,

I haven't have time to investigate it fully yet, but it might be that you can trick the VS versions w/o the test capabilities by wrapping the Test ProjectType Guid element inside a check for the right versions of VS.

http://msdn.microsoft.com/en-us/library/bb383796.aspx

--larsw

I have nothing productive to say, so I probably ought say nothing, but...

Your post describes a dysfunctional system full of features that seem to be at cross purposes to creating software.

Perhaps your point was to highlight that, in which case, bravo!

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment