Unit testing your metro style apps built using XAML TOOL-529T Unit testing your metro style apps built using XAML Peter Provost Senior Program Manager Microsoft Corporation © 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.
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 interface in 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
Visual Studio 11 Unit Test Explorer demo Visual Studio 11 Unit Test Explorer A quick look at the new Unit Test Explorer and unit testing Metro style apps
Unit testing managed XAML apps
Unit Testing an existing managed XAML app 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 AppContainer sandbox 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
Unit Testing an existing managed XAML app 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.
Unit testing native code
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 same language you write your code Design for testability, test in isolation, run your tests frequently Deal with the Windows 8 specific concepts and issues
Unit testing native code 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
Recap
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 feedback http://bldw.in/SessionFeedback
6/4/2018 4:27 AM © 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. © 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.