Unit testing with visual studio 2012

Post on 22-May-2015

2.560 views 1 download

Tags:

Transcript of Unit testing with visual studio 2012

Unit Testing with Visual Studio 2012

The Visual Studio 2012 Unit Testing experience is focused on

developers writing and running unit tests while they write their

code.

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

Quick overview of the new Unit Test Explorer window

Developer Focused Unit Test Experience

Red-Green Bar

Most important

tests shown first

Timings

Shows tests from any

framework

Search

Run Details

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!

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

• 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

Unit testing async methods with MS-Test

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

Using Fakes to create fast-running, isolated unit tests

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

Code Coverage

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

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

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

The Visual Studio 2012 Unit Testing experience is focused on

developers writing and running unit tests while they write their

code.