introducing the new visual studio 2012 unit testing experience peter provost sr. program manager...
TRANSCRIPT
Introducing the New Visual Studio 2012 Unit Testing ExperiencePeter ProvostSr. Program Manager LeadMicrosoft Corporation
DEV214
The Visual Studio 11 Unit Testing experience is focused
on developers writing and running unit tests while they
write their code.
Years of customer feedback
Customers want to use other frameworks for unit testing
MS-Test had a reputation for being slower than other managed frameworksNo real support for non-managed projects and test frameworksMS-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 developersAgile development and TDD approaches aren’t supported well by the current unit test experience
Architecture
Visual Studio Unit Test Explorer
Command Line Runner
TeamBuild Unit Test Activity
Visual Studio Unit Test Platform
MS-Test Manage
d
MS-Test Native
NUnitxUnit.ne
tQUnit MORE!
Developer Focused Unit Test Experience
Red-Green Bar
Most important
tests shown first
Timings
Shows tests from any
framework
Search
Run Details
Use the framework you want to use
In the box support forMS-Test ManagedMS-Test Native (**NEW**)
Third party plugins currently under developmentNUnitxUnit.netMbUnitSQL Server Unit TestingMore!
Many performance and scale improvementsEspecially 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-targetingAvailable in Express!
MS-Test Improvements
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
Isolating code for better testing
The new VS11 Fakes framework lets you test almost ANYTHING in isolation, even when it has external dependenciesDerived from Microsoft Research “Moles” projectFakes 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 implementationsShims – generated classes that enable you to intercept and replace calls to existing classes, even those from the .NET BCL!
Recommendations
StubsA natural extension of well known testing strategiesYou should feel good about using them in your tests.
ShimsAre amazingly powerful and sometimes the only way to test certain things… but they are evil! Use Shims to get your code under testBut don’t stop there…Strive to refactor the code so you don’t need the Shims anymoreThen remove them
Code coverage in VS11
Analyze your code coverage with a single clickAnalyze for selected tests to help find how specific tests are covering your systemSupports native code (via the MS-Test Native framework)Works with third party managed & native frameworks
Team Build Support
If it works in VS, it works on Team Build3rd party frameworksVisual Studio Fakes Isolation FrameworkCode Coverage
Plus…Hosted Build (Team Build in the Cloud)Test Impact Analysis
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
But wait there’s more!
Sharepoint DevelopmentCOMING SOON!Fakes Behaviors Library for Sharepoint Unit Testing
Available in Win8 Express and Web Express!The same unit testing experienceNo extensibility (3rd party framework)No continuous test runnerNo fakes framework
What’s missing?
Test ListsLegacy mode only
Test ImpactWorks on the server, not in the VS client
Private accessorsDeprecated in VS2010, remove in VS11
The Visual Studio 11 Unit Testing experience is focused
on developers writing and running unit tests while they
write their code.
Thank you!
Have questions now?Please use the micsI will stick around outside after
Think of a question [email protected]@pprovost
Peter Provost
Find Me Later At DEV01-TLC: Application Lifecycle Management (ALM)
Related Content
Breakout SessionsDEV214 Introducing the New Visual Studio 11 Unit Testing ExperienceAAP401 Real World Developer Testing with Visual Studio 2012DEV411 Testing Un-testable Code with Fakes in Visual Studio 2012AAP330 Compile & Execute Requirements in .NETHands on LabsDEV17-HOL Explore the New Unit Testing and Code Clone Capabilities of
Visual Studio 2012Product Demo Stations
DEV01-TLC Application Lifecycle Management (ALM)
DEV Track Resources
Visual Studio Home Page :: http://www.microsoft.com/visualstudio/en-us
Jason Zander’s Blog :: http://blogs.msdn.com/b/jasonz/
Facebook :: http://www.facebook.com/visualstudio
Twitter :: http://twitter.com/#!/visualstudio
Somasegar’s Blog :: http://blogs.msdn.com/b/somasegar/
Resources
Connect. Share. Discuss.
http://northamerica.msteched.com
Learning
Microsoft Certification & Training Resources
www.microsoft.com/learning
TechNet
Resources for IT Professionals
http://microsoft.com/technet
Resources for Developers
http://microsoft.com/msdn
© 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.