Bye Bye VSMDI

That blasted VSMDI file.  Well Buck, Tom and crew did it.  They have finally given us the ability to run tests ( albeit all ) found in an assembly regardless of test lists.  http://blogs.msdn.com/buckh/archive/2006/11/04/how-to-run-tests-without-test-metadata-files-and-test-lists-vsmdi-files.aspx I am currently integrating this into TfsAlert and will post my findings.


Simple NMock Working Sample

Based on some conversations I had today, here is a simple NMock example. NMockExample.zip (17.19 KB)

1

Converting a csproj into a test csproj

Short answer. It’s as simple as adding one line to your csproj which in turn tells the IDE to treat that project like a test project.  Add the following line to your main PropertyGroup: <ProjectGuid>{04082EBA-C85C-4336-B3FD-9891096BAA0F}</ProjectGuid> Then just reference Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll and you are on your way.  Be sure to verify that Guid between releases.  Long Answer….

1

Unit Testing with Anonymous Methods

Mark Seemann recently published a great post demonstrating the use of anonymous methods in unit testing events.  Testing Events Using Anonymous Methods That just rocks, thanks Mark!


Multiple Test Runs in one BuildType

If you are using TeamBuild then this post is for you.  In TeamExplorer when you create a new build type it will create a *.proj file.  During the creation of this build type, you will be asked which TestLists you would like executed in that build type.  Once completed if you open that proj file, you will see an item…


ExpectedException Exception Message Validation

While you cannot validate you exception’s message in the ExpectedException attribute all is not lost.  Lets walk through three scenarios. In all three tests you will see an Assert.Fail in the try block.  You need this statement in case the target doesn’t throw any exceptions, therefor failing the test.  The first example is a passing…


ExpectedException might not be what you’ve expected

If you’ve switched from NUnit to the VSTS Unit Testing then I am pretty sure you’ve used the ExpectedException attribute. If you haven’t it looks something like this: [ExpectedException( typeof( ApplicationException ), “Message” )] Using it with a test would look like the following: [TestMethod, ExpectedException( typeof ( ApplicationException ) ) ]public void ut1(){   throw new…

2

MSTest.exe

Stumbled across a command line tool ( MSTest ) which executes your VSTS test list. You can call if from a Visual Studio command prompt or @ C:\Program Files\Microsoft Visual Studio 8\Common7\IDE Upon execution this will create the same output as if you executed your tests inside of Visual Studio.

1