Unit Testing Windows Phone 7 Applications

Must Read

DUI Defense Attorneys

If you are caught driving while drunk, you are definitely in big trouble. The police officers who arrest you...

Easy Debt Consolidation Techniques

Debt consolidation is easily achievable when you know the right steps to take. It will require a few phone...

Role and Responsibilities of a Personal Representative

A Personal Representative (sometimes called an administrator or an executor) is a person who is given the responsibility of...

Federal Government Student Loans – What Kind of Help Can You Get!

Are you ready to go back to college, but you are unsure how you are going to pay for...

Sleep Easier With A Debt Consolidation Loan

American consumers are becoming a lot more educated in their buying habits. This change in awareness as brought...

Re-Financing with a Line of Credit Loan

Some homeowners might consider re-financing with a home equity line of credit as opposed to a traditional loan. There...

Unit testing is the process of exercising individual business objects, state, and validation for your applications. A  comprehensive set of unit tests written before you develop the code, and executed regularly during the entire development cycle, help to ensure that individual components and services are performing correctly and providing valid results.

You can use a special version of the Silverlight Unit Testing Framework adapted for use with Silverlight 3 to run unit tests for Windows Phone 7 applications. You can obtain this from Jeff Wilcox’s site ( Jeff is a Senior Software Development Engineer at Microsoft on the Silverlight for Windows Phone team.

The Silverlight Unit Testing Framework adds the Silverlight Unit Test Application templates to the New Project dialog box in Visual Studio and Visual Studio Express, and you can use this to add a test project to your application. The framework allows you to execute tests that carry the standard Visual Studio test attributes and include the standard test assertions such as IsTrue and IsNotNull. It can be used to run all the unit tests in a solution or selected tests; it reports the results on the phone, showing full details of each test that passed or failed.

You can also run tests on the desktop using a traditional test framework such as the Microsoft Test Framework (MSTest), instead of deploying the application to the phone or the emulator and running it there under the test framework. This is generally faster, but you must be aware that there are some differences in the execution environment, and tests may behave differently on the desktop when compared to running on the emulator or a physical device. When performing integration testing, you should run the tests on the emulator or a physical device.

There are some tests that you cannot run in an emulator. For example, you cannot test the Global Positioning System (GPS) or the accelerometer. In these cases, you may prefer to use alternative testing techniques, such as creating mock objects that represent the actual service or component that your application uses and substituting these for the physical service or component.

To view a video presentation about unit testing using the Silverlight Unit Testing Framework, see Unit Testing Silverlight and Windows Phone Applications on the Mix 10 website (

Automated Unit Testing

It is possible to automate testing on the Windows Phone 7 emulator if you need to implement a continuous integration process and build Windows Phone 7 projects on a separate build server that does not have the Windows Phone Developer Tools installed. This requires setting up a folder for the external dependencies and editing the project files. For more information, see the post, “Windows Phone 7 Continuous Integration,” on Justin Angel’s blog ( logPost=TFS2010WP7ContinuousIntegration).

It is also possible to automate building and deploying an application to a phone or emulator without using Visual Studio. This approach uses the Smart Device Connectivity API implemented in the assembly Microsoft.SmartDevice.Connectivity.dll. For more information about using this API, see “Smart Device Connectivity API
Reference” on MSDN ( and “Windows Phone 7 Emulator Automation” on Justin Angel’s blog (


Latest News

Digital Marketing for Beginners

Digital marketing for starter, Let to basic learning about connecting with your audience in the right place...

What are 7 things poor people do that the rich don’t?

1. poor people watch TV in which people read books how many hours you spend in front of the TV and when...

Top 18 best small business ideas for beginners starting

A small business can be frightening and requires plenty of careful planning there are many small business ideas which can be beneficial...

Summer that makes you happy

We saw were already here I've been thinking about some of the things. I used to do with my husband even though...

4 Point to helpful tips specifically for caregivers

What you need to take a vacation. I know it sounds impossible creative and try to make it work for you almost...

More Articles Like This