I’ve blogged in the past various solution to run NUnit tests during a TFS build, and now it is time to make it again for TFS11, but this time it is incredibly simple, because the new Test Runner supports multiple frameworks, so it works almost automatically.
Figure 1: The new UTE is able to run Unit Tests from multiple framework, because it is extendible
Now if you create a build against this solution, you probably will be disappointed by the fact that the build only runs MStest ignoring tests supported by an external plugin.
Figure 2: Build result shows that only 6 test were run, xUnit and NUnit tests are ignored
This blog post explain the reason, if you are on 64 bit machine, the vsix installer is not able to make the Extension visible to build controller, so you need to do a little extra step. First of all locate the folder of the two extensions under the plugin for the current user
Figure 3: UTE plugins are located in the standard plugin folder for Visual Studio
This location may vary, in my system it installed only for current user so they are on my profile folder, if you do not find the extension there you can simply search for the dll NUnit.VisualStudio.TestAdapter.dll into your Hard Disk. Once you found xUnit and NUnit UTE plugin folder, you should copy all dll inside a source controlled folder.
Figure 4: All UTE plugin assemblies are now in a source controlled folder
Finally go to Team Explorer –> Build –> Actions –> Manage Build Controllers and specify that all custom assemblies are located inside that folder
Figure 5: Configure the test controller specifying the location of all the assemblies that contains build extension
Now you can queue another build, and this time all tests should be run.
Figure 6: Now all 16 tests were run
As you can see, with TFS and VS11 running unit test from various Unit Test Frameworks is really easy.