@Unit testing in VS2012
Ricci Gian Mariahttp://blogs.ugidotnet.org/rgmhttp://[email protected]
@alkampfer
@• 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
@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
@Most important features on front
• One click Code coverage
• Continuous test runner
@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
@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
@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)
@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
@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
@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
@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)
@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
@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
Grazie agli sponsor