Quick-Start Guide To Using xUnit To Test Your Windows 8 WinRT Store app

Until xUnit officially supports* Windows store apps you can get xUnit working with your WinRT app by doing the following:

In Visual Studio 2012, go to Tools menu, Extensions and Updates; search for and install “xUnit.net runner for Visual Studio 2012”.

xUnitRunner

In Visual Studio 2012, go to Tools menu, Extensions and Updates; search for and install “xUnit Test Library Template”.

xUnitTemplate

You may have to restart Visual Studio…

In your Windows 8 app solution, right-click on the Solution, Add, New Project; click on Visual C#/Windows Store, you should see a new project template called “xUnit Test Library (Windows Store Apps)”. Once you’ve added this project, just add a reference to your Windows Store app project and start testing Smile

xunitprojecttemplate

Note: You may need to add specific references that are used in your WIndows Store project manually in the xUnit test project, for example I had to do this for the “Microsoft Advertising SDK for Windows 8 (XAML)”.

 

To learn more about xUnit.net check out my Pluralsight course: The xUnit.net testing framework.

 

* “There are long term plans to support this in 2.0, but the release date is as of yet unknown.” - xUnit CodePlex site

Add comment

Loading