240 likes | 423 Views
TOOL-529T. Unit testing your metro style apps built using XAML. Peter Provost Senior Program Manager Microsoft Corporation. Agenda. New unit t esting c apabilities in Visual Studio 11 Unit t esting managed XAML apps Unit t esting n ative code Recap Key takeaways
E N D
TOOL-529T Unit testing your metro style apps built using XAML Peter Provost Senior Program Manager Microsoft Corporation
Agenda • New unit testing capabilities in Visual Studio 11 • Unit testing managed XAML apps • Unit testing native code • Recap Key takeaways • How to use the new Visual Studio unit testing features • Design your new XAML app for high quality & testability
What is unit testing? • Unit testing is a method by which individual units of source code are tested to determine if they are fit for use • A unit is the smallest testable part of an app • Unit tests are typically written and run by software developers to ensure that code meets its design and behaves as intended
Other kinds of testing • Integration testing • Confirm that the parts work when put together • Functional or system testing • Confirm that the whole system meets the specified requirements • Exploratory testing • A tester intentionally explores areas of the system, looking for inconsistencies or incorrect behavior
Effective unit testing is one of the biggest contributors to high quality software.
Unit testing features in Visual Studio 11
Unit test explorer • New, extensible test runner interfacein Visual Studio 11 • All important information available at a glance • Designed for developers writing tests • Fast and scalable • Available in Win8Express, Pro, Premium and Ultimate editions
Test framework extensibility How do you want to test today? • New plugin model can support any unit testing framework • Built in support for • VS managed tests (aka MS-Test) • New VS native unit testing framework
demo Visual Studio 11Unit Test Explorer A quick look at the new Unit Test Explorer and unit testing Metro style apps
demo Unit Testing an existing managed XAML app What happens when you take an existing app that was not designed for testing and try to add unit tests to it?
Windows 8 concepts & issues • The AppContainersandbox • Isolates your app from the system and vice-versa • Prevents use of many .NET APIs • Requires a special kind of unit test project • Dealing with XAML issues • XAML can only be properly rendered within your app • Try to avoid putting much in the code-behind file
Key elements for success • Design for testability • Test units in isolation from one another • Isolate dependencies • Write tests while you code and run them often
demo Unit Testing an existing managed XAML app Using some well-known patterns to separate logic from UI, we can make the app very easy to test.
Native Unit Testing framework • In Visual Studio 11 we will be introducing a new Unit Testing Framework for C/C++ • Speedy test authoring with terse syntax • Light weight, performant test discovery and execution • Tests are isolated and do not pollute the environment • Fully featured and extensible: fixtures, attributes, assertions, logging, expected exceptions
Testing native C++ overview • Write your tests in the samelanguage you write your code • Design for testability, test in isolation, run your tests frequently • Deal with the Windows 8 specific concepts and issues
demo Unit testing native code If you are using native code today, or plan to use it for your new apps, you can have the same unit testing experience
Unit testing Metro style XAML apps • Visual Studio 11 brings a new focus on developer testing with an improved user experience and extension model • Managed or native code, you choose! • You should use well-known design patterns like MVVM for improved testability
Related sessions • [TOOL-455T] Developing and testing on Windows 8 with Hyper-V • [TOOL-515T] Tips and tricks for developing Metro style apps using XAML • [TOOL-530T] Manual testing of Windows Metro style apps built using HTML • [TOOL-793T] Working on an agile team with Visual Studio 11 and Team Foundation Server 11
thank you Feedback and questions http://forums.dev.windows.com Session feedbackhttp://bldw.in/SessionFeedback
© 2011 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.