Save Time, Money, and Your Sanity: Coded UI Testing for the Windows Phone – Part 1

Developing apps for Windows Phone is increasing in popularity. With the announcements made at //build/ regarding the changes to the Windows Phone platform, and the recent acquisition of Nokia by Microsoft, there is a renewed interest among developers to get on board and develop Windows Phone apps. This is apparent as the number of apps published in the Windows Phone Store continues to grow daily.

Whether you are a mobile app developer within an organization, or an independent app developer, or a hobbyist, the app development lifecycle is always the same: design, develop, test and publish.

However, as I mentioned in a previous post, publishing an app is not the final step in the development life cycle. Developers are tasked with the responsibility of maintaining their portfolio of published apps, whether it includes adding new features, fixing existing bugs, or a combination of both. This can become time consuming and costly. We all know that the first thing that falls to the wayside, when there is no time or money, is testing.

The Solution

In the Windows Phone 8 SDK, Microsoft included the ability for developers to create unit test projects to automate their testing process as much as possible. Unit Test projects allow developers to automate the testing process for the app’s business logic; however there was no automated testing available for the UI, which still required manual testing on the developer’s part. Hold that thought, because I have great news for you!

Along with the vast amount of changes and new features available in Windows Phone 8.1, Microsoft took it one step further and included Coded UI Test projects for Windows Phone 8.1 apps. With the ability to automate tests for your app’s UI, you can now experience a time-savings in your development lifecycle process. As new features are developed, and bugs are addressed, within your Windows Phone app, you no longer have to manually run through the same tests multiple times to ensure that there are no regression issues. You can simply run your automated tests and allow the test projects to handle your dirty work.

Using a combination of Coded UI test projects and Unit Test projects, you can easily set up end-to-end automated testing, which in turn saves you time and money (and maybe even your sanity).

Getting Started with Coded UI Tests

Coded UI Tests are easy to setup, even for developers who have little to no experience in creating test projects. Although it may seem daunting at first, once you step through the process to create your first Coded UI Test, you will see how simple Microsoft has made it for you to incorporate automated UI testing into your app, saving you from hours of tedious and repetitive testing.


Minimum Requirements

Coded UI Test projects are available for Windows 8.1 and Windows Phone 8.1 XAML apps. For this post, we are focusing solely on creating Coded Test UI Projects for Windows Phone 8.1. This requires that you have Visual Studio 2013 Update 2 RC installed, and your edition of Visual Studio must be Premium or Ultimate edition.

Since we are focusing on Windows Phone 8.1 apps, you must ensure that your development machine is running on Windows 8.1 (x64) Professional edition or higher, and your machine must support Client Hyper-V and Second Level Address Translation. Client Hyper-V and SLAT are required to run the Windows Phone Emulator so that you can setup and run Coded UI Tests for Windows Phone apps. If you do not know whether or not your machine supports SLAT, check out my post on Setting Up Your Windows Phone Development Environment, which walks you through the steps you need to take to verify your machine meets the minimum requirements.

With that out of the way, in the next post, we’ll create a coded UI test in 5 easy steps. Stay tuned.

Comments (2)

  1. enough2012 says:

    I was initially excited to learn about Coded UI Tests, they sound cool in theory. But I'm disappointed that this feature is only available for Premium and Enterprise editions. Microsoft: look at Apple, look at Google. Do they charge their partners for tools? In a "mobile first, cloud first" world, MS should really adjust their priorities when it comes to tooling and partnering IMHO.

    Having finished with that rant, it would also great to learn how the lousy rest of us could implement UI automation within universal apps, even if we need to do more manually than the chosen few.

    Thanks for considering this,


  2. Mahendar says:

    Hi Lori,

    Thanks for the blog. Can you please help me with answer for below query?

    1. I understand that for coded UI recordings, i need Premium or Ultimate versions. Do i need to have the same even to run the recordings on test systems? Can I use mstest.exe to execute the recordings without VS Premium or Ultimate?


Skip to main content