Unit Testing for .Net Compact Framework

This blog post should have happened some time ago and the only reason it has taken so long is due to my laziness :-)

With the recent Visual Studio Orcas CTPs, we are shipping preview bits of one of the biggest features Visual Studio for Devices has to offer for Orcas - unit testing for NetCF applications. 

We would love to get feedback/britbats. Note that these are very, very early bits - so please be gentle :-). Here's how you can try it out. Leave a comment or mail any feedback to sriramk at microsoft.com.

 
Preparation

-  Download the CTP

- Make sure your target device or emulator already has NetCF v2 installed. We will *not* deploy it automatically. The easiest way to do this is to simply deploy a v2 project

Steps to run your first device unit test

- Create a NetCF v2 project. Can be anything other than Console Application (we have a bug around Console Applications that will be fixed in the next release)

- On any method, right-click and choose 'Create Unit Tests'

- From the dialog that pops up, choose 'Create a new Smart Device Visual C# Test Project' (or the equivalent VB one). Go ahead and create the test project.

- You should now see a spanking new test project. Go ahead and type in your unit test code. You know you want to :-)

- Click on Test->Windows->Test Manager. You should see a list of all your unit tests.

- Check 'All Loaded Tests'

- Click on 'Run Checked Tests' (the button with the green arrow)

- Voila! Your tests should run and you'll see the results in the test results window

 

Sriram Krishnan