Following up on Brian Harry’s blog, I would like to provide a bit more details on Test Impact Analysis in VS 2010, which will help you “Choose the Right Tests”. I am going to focus on how developers can benefit from Test Impact Analysis (TIA); I will have a separate post on how QA folks can benefit from TIA in a future post (in the meantime, see Amit’s post here). I will also post a blog on how TIA can be enabled for a project shortly.

Test Impact Analysis, as its name implies, will help you analyze the tests impacted as a result of a code change. These tests can be Unit Test or just Manual Tests. So, as a developer, once you make a code change, you will know which unit tests you need to re-run and re-verify. You will also know which tests your QA buddy will run once the code change makes it to QA ;-)

But, before you start using TIA, you need to do a few things. First and foremost, you need to make sure that TIA is turned on. See http://msdn.microsoft.com/en-us/library/dd547176(VS.100).aspx for a discussion on how to turn TIA on. Then you need to make sure that you have one successful build and one successful run of all tests (in which the tests have run and have successfully completed).

Once you have that in place, you are set to take advantage of TIA. In Visual Studio, TIA information is viewed within “Test Impact View” window. You will find Test Impact View under Test | Windows | Test Impact View:

clip_image002[6]

Test Impact View, by default, is displayed where the Solution Explorer is displayed. I would like to draw your attention to 4 separate parts of Test Impact View:

clip_image004[5]

Show Impacted Tests: As its name implies, you can view the Impacted Tests when you select this option, alongside the code changes resulting in the test being impacted. For example, the screenshot below, identifies “TestMultiply” as an impacted test as result of a modification in “Multiply” method.

clip_image006[5]

Show Code Changes: This option, as its name implies, will show you the code changes made to the application (at the method level, of course) alongside the tests impacted as a result of the given code change. For example, the screenshot below shows that as a result of a change to the “Multiply” method, the “TestMultiply” unit test is now impacted and needs to be re-verified.

clip_image008[5]

Show Calling Tests: You can right click on a method and select “Show Calling Tests” to view the tests which will be impacted should you make a modification in that method. For example, I took the screenshot below by right clicking on the “Add” method of the “FaazieMathCalculator” class:

clip_image010[5]

When I select “Show Calling Tests”, Test Impact View will identify “TestAdd” as the test that will be impacted should I make a modification to the “Add” method:

clip_image012[5]

Run Impacted Tests: As its name states, this option will run the impacted tests which can be run from Visual Studio (e.g. Unit Tests). Once a test is successfully run, its status will change from “Impacted” to “Verified”.