Unit Testing in VS2012


Published on

Shows the news capabilities of VS2012 regarding unit testing

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Unit Testing in VS2012

  1. 1. Unit testing in VS2012 Ricci Gian Maria http://blogs.ugidotnet.org/rgm http://www.codewrecks.com alkampfer@nablasoft.com @alkampfer
  2. 2. Agenda• 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
  3. 3. A new shiny test runner• Integrated in VS• Pluggable test framework• Simpler to use• Faster than older runner Test Runner• More agile-tester-oriented Agile Tester
  4. 4. Most important features on front• One click Code coverage• Continuous test runner
  5. 5. New features, revamp of older onesand dropped functionalitiesOne-click code coverage No more oscure settings No more needs of test configuration for basic runNew features Continuous test (aka run test after builds) Agile test runner C++ unit test frameworkRemoved features No more dev test impact (only available on builds) No more tests lists Old test runner is gone
  6. 6. Compatibility with VS2010Support for VS2010 test project fileNew format of test project No need of .testsettings file New test project templatesSettings are obsolete and deprecated Used only for specific scenario like remote execution To use Diagnostic data adapter http://tinyurl.com/vs2012testupgrade
  7. 7. Some missing feature for old MsTestusers• 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)
  8. 8. 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
  9. 9. 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
  10. 10. 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
  11. 11. Coded UI Test Compatibility withVS2010• 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)
  12. 12. 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
  13. 13. 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
  14. 14. Grazie agli sponsor