How to: Run Automated Tests from a Test Plan Using Microsoft Test Manager
If you have already created automated tests by associating each automated test method with a test case, you can run these tests from Microsoft Test Manager. For more information about how to associate your automated test method with a test case, see How to: Associate an Automated Test with a Test Case.
To run the latest version of your automated test, you must make sure that the correct build is selected for your test plan. You must also use a physical or virtual environment to run your automated tests.
Important
If you are not using Team Foundation Build to build your application and tests, you can still run automated tests using Microsoft Test Manager. You must create a build definition that just has a share location added that is where your assemblies for your tests are located.
The build definition must be triggered at least once to create a build instance that can be associated with the test plan. If you don't have the Team Foundation Server 2010 build infrastructure set up, then you must create a fake build for the build definition. For more information, see Jason Prickett’s Blog: Creating Fake Builds in TFS Build 2010. You can create fake builds from the command line using the following parameters:
TfsCreateBuild.exe /collection:http://tfsservername:8080/tfs/collectionname /project: projectname /builddefinition:"Nightly Build" /buildnumber:"Application_Nightly_1.0"
Use the following procedures to set up your test plan and run the tests using the appropriate environment and test settings and view the results after you have run the tests:
Set Up Your Test Plan To Use Your Team Build
Create Your Test Settings and Environment to Run Your Tests
Run the Automated Test Using Microsoft Test Manager
View and update the test results
Note If you want to run your tests using a different build, test settings, or environment than the values that have been set up for your test plan, you can use Run with options when you select the tests to run.
Set Up Your Test Plan To Use Your Team Build
To set up your test plan to run the latest version of your automated test methods, you must choose the correct build definition used to build your automated test and then select the correct build. Or you can use a build definition that has the correct build drop location for your existing automated test assemblies. You must select the correct build so that the automated test can be found in the share location for your build definition and then it can be run from Microsoft Test Manager.
Important
If you have multiple build configurations, the test assemblies to run the automated tests are searched for recursively from the root directory of the build drop folder. If it is important which assemblies are selected when you run your automated tests, you should use Run with options to specify the build configuration. For more information about how to do this, see How to: Override Settings in Your Test Plan For Test Runs.
To set up your test plan to use the correct build
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.
To create a test plan, click the down-arrow on the center group switcher and then click Testing Center.
On the center group menu bar, click Plan.
(Optional) If you are not already connected to the correct plan, you can select the test plan. Click Set Plan Context to show the existing test plans. Select the test plan and then click Set context.
Click Properties.
To set up your test plan to use the correct build, click the drop-down arrow on the combo box for Filter for builds.
The dialog box to filter the builds is displayed.
To select the build definition that is used to build your automated tests, click Build definition.
Each build can be given a specific value to reflect the quality of the build. To select the quality of the builds you want to be able to view, click Build quality.
Note
For more information about build definitions and build quality, see Define Your Build Process.
To save your changes, click Set build filter.
To select the build to use with this test plan that includes the latest changes to the automated test, you must first click Save to save the plan and then click Modify.
The Assign Build activity is displayed. You can compare your current build with a build you plan to use for your testing. The associated items list shows the changes to work items between the builds. You can then assign the latest build to use for testing with this plan. For more information about how to select a build, see Determining Which Builds Have Bug Fixes, New Features, or Requirements.
To close the Assign Build activity and return to the test plan properties, click the Close icon.
To save these changes for this test plan, click Save on the toolbar.
Create Your Test Settings and Environment to Run Your Tests
To run your automated tests, you must use a physical or virtual environment. You cannot run automated tests using Microsoft Test Manager without an environment.
You must create an environment that contains the roles in your test settings and then use this environment in your test plan. For more information about how to create your environment and roles and test settings, see Setting Up Test Machines to Run Tests or Collect Data.
Note
If you want to run automated tests that interact with the desktop, you must set up your agent to run as a process instead of a service. For more information, see How to: Set Up Your Test Agent to Run Tests that Interact with the Desktop.
To create your test settings and environment to run your tests
To create a physical environment, follow the steps in this topic: Creating a Physical Environment to Use for Testing.
If you are using Visual Studio Lab Management, you can create a virtual environment. To create a virtual environment, follow the steps in this topic: How to: Create an Environment from Virtual Machines or Templates. If you want more information about how to create virtual environments, see Virtual Environments Concepts and Guidelines.
To create your test settings, follow the steps in this topic: Create Test Settings for Automated Tests as Part of a Test Plan.
Run the Automated Test Using Microsoft Test Manager
To run the automated test using Microsoft Test Manager
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.
To run the automated test, click the down-arrow on the center group switcher and then click Testing Center.
On the center group menu bar, click Test.
(Optional) To override the build, the test settings or the environment to use for running the automated tests that you select in this test plan, right-click the test and then click Run with options. For example, if you want to run on a staging environment instead of your standard testing environment then you might choose a different environment. From the Run options dialog box, you can change these settings, and then click Run to run the selected test.
Note
If you select a different environment, it must have the same roles as the environment that was created in the test settings that you use.
To run the automated test without changing any options, right-click the test and then click Run.
The Analyze Test Runs activity is displayed that shows the progress of the test run that contains this test.
Note
You can run multiple automated tests by selecting multiple tests, or you can select to run a whole suite of tests. To run a suite, right-click the test suite and then click Run.
View and Update the Test Results
To view and update the test results
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.
To view the test results, click the down-arrow on the center group switcher and then click Testing Center.
On the center group menu bar, click Test and then click Analyze Test Runs.
The Analyze Test Runs activity is displayed. It shows any test runs for this test plan.
Double-click a test run to open it and view the details.
The test run details are displayed.
(Optional) To update the title of your test run to be more meaningful, type the new name in Title.
(Optional) If your test failed, you can update the reason for the failure. Click Resolution and select the reason for the failure from the list.
(Optional) To add comments to the test result, click the Comments icon. Type your comments and then click Save comments.
(Optional) To view the details of the individual test, double-click the test.
The test result is displayed that shows the details from the test run, the attachments for data collected for this test result, and the test results history for that test. You can close this view to return to the test run.
Note
If, from your analysis, you determine that there is a bug, you can create a bug from this view.
To save these changes for this test run, click Save in the toolbar.
See Also
Tasks
How to: Associate an Automated Test with a Test Case