1 / 30

Introducing the New Visual Studio 2012 Unit Testing Experience

DEV214. Introducing the New Visual Studio 2012 Unit Testing Experience. Peter Provost Sr. Program Manager Lead Microsoft Corporation. The Visual Studio 11 Unit Testing experience is focused on developers writing and running unit tests while they write their code.

nedra
Download Presentation

Introducing the New Visual Studio 2012 Unit Testing Experience

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DEV214 Introducing the New Visual Studio 2012 Unit Testing Experience Peter Provost Sr. Program Manager Lead Microsoft Corporation

  2. The Visual Studio 11 Unit Testing experience is focused on developers writing and running unit tests while they write their code.

  3. Years of customer feedback • Customers want to use other frameworks for unit testing • MS-Test had a reputation for being slower than other managed frameworks • No real support for non-managed projects and test frameworks • MS-Test very slow to evolve as the unit testing world changes (e.g. xUnit.net, BDD frameworks, mocking frameworks, etc.) • The VS experience feels like it was designed for testers not developers • Agile development and TDD approaches aren’t supported well by the current unit test experience

  4. Quick overview of the new Unit Test Explorer window demo

  5. Architecture Visual Studio Unit Test Explorer Command Line Runner TeamBuild Unit Test Activity Visual Studio Unit Test Platform MS-Test Managed MS-Test Native NUnit xUnit.net QUnit MORE!

  6. Developer Focused Unit Test Experience Search Red-Green Bar Most important tests shown first Timings Shows tests from any framework Run Details

  7. Use the framework you want to use • In the box support for • MS-Test Managed • MS-Test Native (**NEW**) • Third party plugins currently under development • NUnit • xUnit.net • MbUnit • SQL Server Unit Testing • More!

  8. MS-Test Improvements • Many performance and scale improvements • Especially when you stick to “classic” unit testing • Support for testing Async [TestMethod] public async Task MyAsyncTest() { var result = await SomeLongRunningOperation(); Assert.IsTrue( result ); } • Proper support for 64-bit and .Net multi-targeting • Available in Express!

  9. Unit testing async methods with MS-Test demo

  10. Strong Compatibility with VS2010 • VS2010 Unit Test Projects should “just work” in VS11 without any upgrade (and round-trip back to VS 2010) • TeamBuild in TFS 11 can be configured to use the VS2010 compatible runner or the new VS11 runner

  11. Isolating code for better testing • The new VS11 Fakes framework lets you test almost ANYTHING in isolation, even when it has external dependencies • Derived from Microsoft Research “Moles” project • Fakes come in two flavors • Stubs – concrete implementations of interfaces or abstract classes that you can pass in to your system-under-test to isolate it from real implementations • Shims – generated classes that enable you to intercept and replace calls to existing classes, even those from the .NET BCL!

  12. Using Fakes to create fast-running, isolated unit tests demo

  13. Recommendations • Stubs • A natural extension of well known testing strategies • You should feel good about using them in your tests. • Shims • Are amazingly powerful and sometimes the only way to test certain things… but they are evil!  • Use Shims to get your code under test • But don’t stop there… • Strive to refactor the code so you don’t need the Shims anymore • Then remove them

  14. Code coverage in VS11 • Analyze your code coverage with a single click • Analyze for selected tests to help find how specific tests are covering your system • Supports native code (via the MS-Test Native framework) • Works with third party managed & native frameworks

  15. Code Coverage demo

  16. Team Build Support • If it works in VS, it works on Team Build • 3rd party frameworks • Visual Studio Fakes Isolation Framework • Code Coverage • Plus… • Hosted Build (Team Build in the Cloud) • Test Impact Analysis

  17. Unit Testing on Team Build in the Cloud demo

  18. Continuous Testing • Running your Unit Tests should be a natural part of doing a build • “Run Tests After Build” option will run your Unit Tests after each successful build

  19. Continuous Testing demo

  20. But wait there’s more! • Sharepoint Development • COMING SOON!Fakes Behaviors Library for Sharepoint Unit Testing • Available in Win8 Express and Web Express! • The same unit testing experience • No extensibility (3rd party framework) • No continuous test runner • No fakes framework

  21. What’s missing? • Test Lists • Legacy mode only • Test Impact • Works on the server, not in the VS client • Private accessors • Deprecated in VS2010, remove in VS11

  22. The Visual Studio 11 Unit Testing experience is focused on developers writing and running unit tests while they write their code.

  23. Thank you! Have questions now? • Please use the mics • I will stick around outside after Think of a question later? peter.provost@microsoft.com www.peterprovost.org @pprovost Peter Provost Find Me Later At DEV01-TLC: Application Lifecycle Management (ALM)

  24. Related Content • Breakout Sessions • DEV214 Introducing the New Visual Studio 11 Unit Testing Experience • AAP401 Real World Developer Testing with Visual Studio 2012 • DEV411 Testing Un-testable Code with Fakes in Visual Studio 2012 • AAP330 Compile & Execute Requirements in .NET • Hands on Labs • DEV17-HOL Explore the New Unit Testing and Code Clone Capabilities of Visual Studio 2012 • Product Demo Stations • DEV01-TLCApplication Lifecycle Management (ALM)

  25. DEV Track Resources • Visual Studio Home Page :: http://www.microsoft.com/visualstudio/en-us • Somasegar’s Blog :: http://blogs.msdn.com/b/somasegar/ • Jason Zander’s Blog :: http://blogs.msdn.com/b/jasonz/ • Facebook :: http://www.facebook.com/visualstudio • Twitter :: http://twitter.com/#!/visualstudio

  26. Resources Learning TechNet • Connect. Share. Discuss. • Microsoft Certification & Training Resources http://northamerica.msteched.com www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet http://microsoft.com/msdn

  27. Required Slide Complete an evaluation on CommNet and enter to win!

  28. MS Tag Scan the Tag to evaluate this session now on myTechEd Mobile

  29. © 2012 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.

More Related