Test Impact Analysis

This is Syed Aslam Basha here from Relationship experience division (RXD)  team.

Test impact analysis helps developers to quickly identify the tests(unit/CUIT) that need to be run for the latest code change. It’s one of the features in visual studio 2010 (VS) available in Premium and Ultimate editions. It works with only managed code.

Let me show Test impact analysis with a Sample web application which has a web page and a class along with Test project.

  • Launch visual studio 2010
  • Click on new project ->Visual C# - Test – Test Project ( make sure you have selected .NET Framework4 to see the test project)
  •  clip_image002
  • Give appropriate project name and save the project
  • Close VS
  • Launch VS 2010
  • Click file-> New project - > Web -> select ASP.NET web application
  • clip_image004
  • Give appropriate project name and save the project
  • Right click and add new class and close the solution.
  • Open the test project and add the website. The solution will look like
  • clip_image005
  • Create a simple method in class file as DisplayText which returns string
  •  clip_image006
  • Create unit test for the above method in UnitTest1.cs as
  • clip_image007
  • Launch test impact view by clicking on Test -> Windows - > Test impact view
  • clip_image008
  • If the test impact diagnostic data is not enabled, click on the link in test impact view window to enable it. Alternatively, you can also set it in test settings as below ( Test -> Edit test settings - > Data and diagnostics)
  •  clip_image010
  • Now build the solution and run the unit test to baseline data
  • Click on Test-> Windows -> Test view
  • clip_image011
  • Select the test method and click on run
  • clip_image012
  • At this point the test impact view will look like
  • clip_image013
  • Now, lets change the code in DisplayText method and add line of code as
  •  clip_image014
  • Since there is change in code it shows up in impacted tests as
  • image
  • Select the impacted test and click on run tests. Make sure the unit test passes to ensure the code change hasn’t effected the test case.

 

- Syed Aslam Basha ( syedab@microsoft.com )

Relationship experience division (RXD) Team

Test Lead

---------------------------------------------------------

Please leave a comment if the blog post has helped you.