Getting started with Coded UI Testing for your Windows 8.1 Store Apps

 

Editor’s Note: In partnership with Microsoft Press, MVPs have been contributing to an ongoing guest series on their official team blog. Today’s article is from Visual Studio ALM MVP Mike Douglas which is the 30th in the series.

I recently created and published my first Windows 8 Store application to the store.  I created it using XAML/C# and followed the MVVM pattern.  As you can imagine I learned a number of things throughout the process.  Now that it is done, I want to rewrite the underlying codebase using those lessons learned.  So how can you rewrite the code but ensure that none of the functionality breaks?  Unit tests provide a great way to regression test your application.  However, adding dependency injection and better unit tests is one of the things I need to do as part of the rewrite, so this won’t provide me the test coverage to ensure that my application is functioning properly.  In addition, the unit tests will only test the individual components and not be able to test all of the layers and ensure the UI is functioning properly.   Coded UI Testing has traditionally provided the mechanism for creating functional tests that tests all of the layers the can be used for regression testing.  With Windows 8 store apps however, Coded UI Tests were not supported and I wouldn’t be able to verify the gestures in my application.

Now with the release of Windows 8.1 and Visual Studio 2013, Coded UI Tests can provide automated functional testing against the UI including not only the mouse and keyboard inputs, but also to verify that the gestures react properly. 

How do I get started?

The first two things you need are Windows 8.1 and Visual Studio 2013.  Using only one of these will not work.  Also, Coded UI Tests for Windows 8.1 only supports XAML based applications.  If your application was written for Windows 8.0, you need to retarget it to Windows 8.1.  This is done very easily by opening the project in Visual Studio 2013, right clicking on the project, and selecting Retarget to Windows 8.1.  For more information on retargeting your application, see the MSDN article Retarget your Windows Store app to Windows 8.1.

 

 

 To read the full article, click here