Many people would like to use xUnit to test their Metro-style applications. While this isn’t yet currently possible with the main xUnit binaries, I have updated the code to get it working on WinRT. Without getting into the nitty-gritty, I’ve created a Project Template that’ll make it a snap to get started.
You’ll need two things
- The xUnit.net runner for Visual Studio 2012. This lets the Unit Test Explorer recognize and run xUnit tests.
- The xUnit Test Library Template for Windows Store apps. With this, you can easily create a unit test project to test your metro style applications and libraries.
I haven’t yet created a template installer VSIX for the Code Gallery, but that’s coming soon – need to resolve a few issues with it first.
For now, just extract the zip file into your Documents\Visual Studio 2012\Templates directory. It’ll put a file into the Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#\Windows Metro style directory.
UPDATE (8/29/2012): For the RTM version, I’ve now created a VSIX installer for the template, so just grab it off of the gallery and you’ll be good to go.
If you have Visual Studio running, you’ll have to restart it to pickup the new template; once you do, you’ll see the following in the File –> New Project dialog:
That’s all folks, just add a reference to the libraries you want to test and get started. There’s a passing test already in the template so you can verify that it works for you.