Unit testing with visual studio 2012
-
Upload
abhimanyu-singhal -
Category
Technology
-
view
2.560 -
download
1
Transcript of Unit testing with visual studio 2012
![Page 1: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/1.jpg)
Unit Testing with Visual Studio 2012
![Page 2: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/2.jpg)
The Visual Studio 2012 Unit Testing experience is focused on
developers writing and running unit tests while they write their
code.
![Page 3: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/3.jpg)
Years of customer feedback• MS-Test Framework Issues• MS-Test too slow• Bad C/C++ support• MS-Test missing new features
• Experience Issues• Designed for testers not developers• Not good for Agile & TDD
![Page 4: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/4.jpg)
Quick overview of the new Unit Test Explorer window
![Page 5: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/5.jpg)
Developer Focused Unit Test Experience
Red-Green Bar
Most important
tests shown first
Timings
Shows tests from any
framework
Search
Run Details
![Page 6: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/6.jpg)
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!
![Page 7: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/7.jpg)
Use the framework you want to use• In the box support for• .NET • Native C/C++
• Third party plugins• NUnit• xUnit.net• MbUnit• QUnit/Jasmine• SQL Server Unit Testing
• Under development
![Page 8: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/8.jpg)
• 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!
MS-Test Improvements
![Page 9: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/9.jpg)
Unit testing async methods with MS-Test
![Page 10: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/10.jpg)
Isolating code for better testing• The new VS11 Fakes framework lets you
isolate almost ANYTHING in .NET• Fakes come in two flavors• Stubs – concrete implementations of
interfaces or abstract classes• Shims – run-time interception lets you
replace calls, even those from the .NET BCL
![Page 11: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/11.jpg)
Using Fakes to create fast-running, isolated unit tests
![Page 12: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/12.jpg)
Code coverage in VS 2012Analyze your code coverage with a single click
Analyze for selected tests to help find how specific tests are covering your system
Supports all managed & native frameworks
![Page 13: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/13.jpg)
Code Coverage
![Page 14: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/14.jpg)
Team Foundation Build• If it works in Visual Studio, it works on
Team Foundation Build• 3rd party frameworks• Visual Studio Fakes Isolation Framework• Code Coverage
• Plus…• Hosted Build (Team Build in the Cloud)• Test Impact Analysis
![Page 15: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/15.jpg)
Continuous Testing• “If you aren’t running your unit tests,
you are just compiling. You are not building.”
Chris PattersonProgram ManagerTeam Foundation Build
• Run Tests After Build option in Visual Studio 2012 will run your Unit Tests after each successful build of your solution
![Page 16: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/16.jpg)
What’s missing?
• Test Lists• Legacy mode only
• Test Impact• Works on the server, not in the VS client
• Private accessors• Deprecated in VS 2010, removed in VS
2012
![Page 17: Unit testing with visual studio 2012](https://reader036.fdocuments.us/reader036/viewer/2022062513/555edd90d8b42a772f8b52c8/html5/thumbnails/17.jpg)
The Visual Studio 2012 Unit Testing experience is focused on
developers writing and running unit tests while they write their
code.