Recommending Tests to Run That are Affected by Code Changes

You can use Visual Studio Ultimate  or Visual Studio Test Professional 2010 to help you determine which tests might have to be run, based on coding changes that were made to the application you are testing. To be able to use this functionality, you have to use Team Foundation Build to build your application and use Microsoft Visual Studio 2010 for version control for your source code.

Note

This functionality to determine which tests might have to be run, based on coding changes, is only supported for applications developed using managed code.

To find the recommended tests, you must first run your manual tests using Test Runner or run your automated tests. When you run these tests, you have to use test settings that collect the test impact data. This test impact data contains information about which methods are called when you run your tests. These links between methods in your application and test cases are stored to determine which test cases should be recommended to run again based on changes to the methods.

Note

Test impact data is only collected when tests run and pass. This creates a baseline to gather valid data for which methods are used when the full test is run. When a test fails, only partial data of the methods that were used to run the test could be collected. This partial data would be inaccurate.

When a new build is created, any changes that were made to methods since a previous build and checked in using version control are compared with the test impact data. If you view the details of a specific build, you can see any impacted tests. For example, if a bug is fixed that updates a specific method, you can then compare the builds to find the recommended test cases as shown in the following illustration.

Recommended Tests

Note

Only test cases are displayed here. Automated tests that are not associated with test cases are not displayed in the Recommended Tests activity. For example, to view unit tests that might be impacted by a new build that are not associated with a test case, you can open the details for the specific build from Microsoft Visual Studio 2010.

Tasks

Use the following topics to help you determine which tests are recommended to be run after code changes to your application:

Tasks

Associated Topics

Setting up your test settings to collect test impact data: You must use test settings that collect test impact data for your application when you run your tests.

How to: Collect Data to Check Which Tests Should be Run After Code Changes

Select a team build to use for your testing: you must select which build you are currently using to run your tests. This is then used as a basis to compare with other builds to determine the test cases that are recommended that you run again.

How to: Select a Build For Your Test Plan

Running your tests: You must run your tests using the test settings so that you can collect the test impact data for your tests. The test impact data will be attached to your test results with a file name extension of testimpact.xml. Only test impact data for tests that pass is saved. You must start any processes for the application after you start the first test in your test run.

Running Manual Tests Using Test Runner

Running Automated Tests

Finding the recommended tests to run: You must select the latest build to use for your testing. Then you can compare this build with previous builds to see which test cases are recommended to be run based on the code changes that have occurred since the previous build.

How to: Find the Recommended Tests to Run After Code Changes

See Also

Concepts

Running Tests

Determining Which Builds Have Bug Fixes, New Features, or Requirements