14
@ Unit testing in VS2012 Ricci Gian Maria http://blogs.ugidotnet.org/rgm http://www.codewrecks.com [email protected] @alkampfer

Unit Testing in VS2012

Embed Size (px)

DESCRIPTION

Shows the news capabilities of VS2012 regarding unit testing

Citation preview

Page 1: Unit Testing in VS2012

@Unit testing in VS2012

Ricci Gian Mariahttp://blogs.ugidotnet.org/rgmhttp://[email protected]

@alkampfer

Page 2: Unit Testing in VS2012

@• A new shiny test runner• Continuous test and code coverage

made super-easy• Real or fake? A world of shims.• Coded-Ui test and Testing Team• Visual Studio Specific tests • Running test in a Build

Agenda

Page 3: Unit Testing in VS2012

@A new shiny test runner

Test Runner

• Integrated in VS• Pluggable test framework• Simpler to use• Faster than older runner• More agile-tester-oriented

Agile Tester

Page 4: Unit Testing in VS2012

@Most important features on front

• One click Code coverage

• Continuous test runner

Page 5: Unit Testing in VS2012

@New features, revamp of older ones and dropped functionalities

One-click code coverageNo more oscure settingsNo more needs of test configuration for basic run

New featuresContinuous test (aka run test after builds)Agile test runnerC++ unit test framework

Removed featuresNo more dev test impact (only available on builds)No more tests listsOld test runner is gone

Page 6: Unit Testing in VS2012

@Compatibility with VS2010

Support for VS2010 test project fileNew format of test project

No need of .testsettings fileNew test project templates

Settings are obsolete and deprecatedUsed only for specific scenario like remote executionTo use Diagnostic data adapter

http://tinyurl.com/vs2012testupgrade

Page 7: Unit Testing in VS2012

@Some missing feature for old MsTest users

• Test Lists –deprecated in 2010 no more supported

• Still no ability to group tests in test runner

• Run test by category only with command line test runner

• Vstest.console Calculator.test.dll /UseVsixExtensions:true /TestCaseFilter: « TestCategory=xxx»

• Works only for MSTest (or for provider that willingly parse the TestCategory attribute)

Page 8: Unit Testing in VS2012

@Isolation library – Visual Studio fakes

• A Stub is a Test Double with behavior set in the test to make test repeatable

• A shim or shiv is a small library that transparently interceps an API.. (Wikipedia)

• They makes untestable code testable• Only available in VS Ultimate• Is the last resort to test legacy code for

refactoring/update/upgrade

Page 9: Unit Testing in VS2012

@Coded UI tests

• Record User – Software interaction• Playback the application replaying user

action• Based on «pluggable» component• Use better technology when possible• Permits to third party company to support theirs

controls (Es. Telerik)

• Records high level interation when possible

• Does not record mouse clicks or keyboard strokes only

• Try to understand what the user does • Aggregates operations

• Collaboration with Test Teams using Microsoft Test Manager

Page 10: Unit Testing in VS2012

@Coded UI New features

• Support for IE9/IE10 (HTML5 support)• New api focusing on hand-code CUIT• Description and assertion message in

CUIT test recorder

• News http://tinyurl.com/vs2012cuit

Page 11: Unit Testing in VS2012

@Coded UI Test Compatibility with VS2010• No Silverlight support (use VS2010

feature pack 2 unit test project)• No Firefox support (use VS2010

feature pack 2 unit test project)• New API (can be used only in VS2012

CUIT test project• Cannot add CUIT to VS2010 test

project that has not already a CUIT in it (create a CUIT with vs2010, then open in VS2012 to do repair process)

Page 12: Unit Testing in VS2012

@Web Performance tests

• Available since VS 2005 and evolved through each VS upgrade

• Request/replay based test• Record in IE • Manipulation from a specific editor in VS• Advanced request/response correlation feature• Advanced extraction rules to grab content from

responses• Easy to write plugin• Advanced feature es. cycles

Page 13: Unit Testing in VS2012

@Run test in builds

• The new test engine is integrated with TFS2012 builds

• Faster runner• Supports test impact• Supports third party framework

http://tinyurl.com/VS2012TestDiscover

• Run Nunit, xUnit, etc in a build and have results automatically stored with the build

• Unit test in build indicates health of the project

• Is the grounding for Continuous Delivery http://tinyurl.com/TFSContinuousDelivery

Page 14: Unit Testing in VS2012

Grazie agli sponsor