Unit Testing Silverlight & Windows Phone Applications Jeff Wilcox Senior Software Development Engineer Silverlight [email protected].
Download ReportTranscript Unit Testing Silverlight & Windows Phone Applications Jeff Wilcox Senior Software Development Engineer Silverlight [email protected].
Unit Testing Silverlight & Windows Phone Applications Jeff Wilcox Senior Software Development Engineer Silverlight [email protected] Outline • Getting Started – What’s new in Silverlight testing – Unit testing in 5 minutes • • • • Silverlight Testing Walkthrough Testing Windows Phone Apps Wild Stuff Questions Silverlight Unit Testing • Old Test Framework New Test Features • Modern user interface – Silverlight-based – Simple, focused user experience – Out of Browser support • Results management – Copy results to the clipboard – Elevated apps can e-mail Silverlight Unit Testing • New for 2010 New Test Features • Better performance • Automation improvements – Command-line executable – Windows XP support – Out-of-browser launcher What is Unit Testing? Goal is to exercise business objects, states, validators. Keep the suits happy. Not so much… - Integration testing - User interface automating - Rendering verification Unit Tests are Important • • • • Tests are important assets Maintain a “suite of pain” for your code Invest in your product for the long term Consider test-driven development Unit Test Metadata Attributes Assertions [TestClass] [TestMethod] [ExpectedException(…)] [Priority(0)] Assert.IsTrue Assert.IsNotNull Assert.IsInstanceOfType StringAssert.Contains DEMO SILVERLIGHT UNIT TESTING Windows Phone Testing Where to start? Windows Phone Testing Same exact Silverlight unit test framework Windows Phone Testing Windows Phone Unit Testing • Silverlight Unit Test Framework • Same Visual Studio unit test metadata – Run existing Silverlight unit tests – Run .NET unit tests • Explore results – on the phone or in the emulator – in debug output DEMO TESTING WINDOWS PHONE APPS Windows Phone APIs • • • • • Accelerometer GPS Licensing Phone Tasks Vibration How to test phone APIs • Crawl – Manual & exploratory testing • Walk – Inversion of Control (IoC) with mocking • Run – Only time will tell DEMO TESTING WINDOWS PHONE APIS Wild Stuff • • • • Automating tests during daily builds Verifying storyboards, states, visual properties Asynchronous testing Testing WCF RIA Services and Silverlight apps as one large system • Network, authentication, authorization • User interface automation Wednesday Session Improving Software Quality for the Modern Web Learn about many testing methodologies for agile, modern web developers Euan Garden Wed 3:00 PM in Breakers J Call to Action • Get the bits today http://jeffatmix.com/ • In the next Silverlight Toolkit release http://silverlight.codeplex.com/ Ships with Silverlight 4 Questions? • Jeff Wilcox – Email [email protected] – Talk resources www.jeffatmix.com – Blog www.jeff.wilcox.name Please fill out an evaluation form!