240 likes | 485 Views
Unit Testing Silverlight & Windows Phone Applications. Jeff Wilcox Senior Software Development Engineer Silverlight jwilcox@microsoft.com. Outline. Getting Started What’s new in Silverlight testing Unit testing in 5 minutes Silverlight Testing Walkthrough Testing Windows Phone Apps
E N D
Unit Testing Silverlight & Windows Phone Applications Jeff Wilcox Senior Software Development Engineer Silverlight jwilcox@microsoft.com
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 [TestClass] [TestMethod] [ExpectedException(…)] [Priority(0)] Assertions 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 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 jwilcox@microsoft.com • Talk resources www.jeffatmix.com • Blog www.jeff.wilcox.name Please fill out an evaluation form!
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.