Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running XUnit.net Tests with TestDriven.net

I've used NUnit for years and I wanted to try XUnit. So I installed XUnit and ran the executable that allowed you to run XUnit via TD.net.

I can't seem to run more than one test at a time. With NUnit + TD.net, I could click on the filename in the solution and run all the tests in the file. I can't seem to do that with XUnit + TD.net.

Is this something I can do?

like image 690
Eric Neunaber Avatar asked Nov 29 '08 14:11

Eric Neunaber


2 Answers

Make sure you run the installer that comes with XUnit.net. There is a button to click that will install the TestDriven.net support.

The problem you are having is described here: http://www.codeplex.com/xunit/Wiki/View.aspx?title=FaqTestDrivenNet&referringTitle=Home

like image 197
Andrew Davey Avatar answered Oct 22 '22 10:10

Andrew Davey


Short Answer: Copy the following into a .reg file on your computer, updating the path to where your Xunit dll resides, and then import it into your registry.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\MutantDesign\TestDriven.NET\TestRunners\xunit] @="4" "AssemblyPath"="C:\_Files\Programs\Programming\XUnit\xunit-1.1.0\xunit.runner.tdnet.dll" "TypeName"="Xunit.Runner.TdNet.TdNetRunner"

Long Answer:

I've run into this problem a couple of times, both on 32 and 64 bit versions of windows. TestDriven.net uses the registry to store a list of test frameworks avaialable. XUnit comes with an installer xunit.installer (run as admin) which is supposed to make the correct registry entries.

Usually I can get TD.net to work with XUnit for awhile, then I loose support. Today I was trying to get it to work on Windows 7 beta for the first time and couldn't get it to work at all.

After some searching I found the registry key that the information about the test framework should be entered in.

HKEY_LOCAL_MACHINE\SOFTWARE\MutantDesign\TestDriven.NET\TestRunners

Now on 64bit systems, there is also a key under the Wow6432Node, which is where it looks like the Xunit installer was setting the registry key.

Anyway, I exported the the the xunit registry key from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MutantDesign\TestDriven.NET\TestRunners\xunit and, edited it, removing the Wow6432Node and then imported it. After restarting visual studio, everything works. I'll keep the registry file around in case it breaks again.

like image 24
ASalvo Avatar answered Oct 22 '22 09:10

ASalvo