Assuming you’ve Mango tools setup already. Get Mango compatible SL unit testing framework bits from Jeff’s blog. Sample project is available here. Setting it up..
<p>This is a tiny experiment to automate parts of unit testing in Windows Phone 7.5 (Mango, here onwards). We will extend silverlight unit testing framework to store the results of a Mango unit test in MSTest test results format in application Isolated Storage and finally fetch them onto desktop.</p>
- Add IsolatedStorageReportingProvider.cs to your test project - Wire it up with the UnitTestHarness in your application entry page (see my MainPage.xaml.cs). By the way, Silverlight Unit Test framework code is available on codeplex. Feel free to explore :)
</p> <div class="CodeRay"> </p> <div class="code"> </p> // Set custom log writerIsolatedStorageReportingProvider isoLog = new IsolatedStorageReportingProvider(((MobileTestPage)testPage).UnitTestHarness.Settings.TestService);((MobileTestPage)testPage).UnitTestHarness.Settings.TestService.RegisterService(Microsoft.Silverlight.Testing.Service.TestServiceFeature.TestReporting, isoLog);// Uncomment this to automatically terminate the test application after test is complete!//isoLog.LogPublished += new EventHandler(this.OnTestHarnessCompleted);(Application.Current.RootVisual as PhoneApplicationFrame).Content = testPage; </div> </p> <p> </div> </p> <p>
- Fire up ISETool.exe to get the results onto desktop
- With some ISETool.exe and MSBuild fu, it should be possible to get continuous integration magic. In this context, Richard Szalay‘s WP7CI project looks promising. I haven’t tried it, may be it is possible to reuse the same set of scripts. - Publishing these results to TFS servers may be possible too. Looks like testresults.trx requires some additional files to work correctly in VS (could be because of vsmdi test metadata?)