Export (0) Print
Expand All

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 noteImportant

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:

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 noteImportant

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

  1. Open Microsoft Test Manager.

    NoteNote

    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.

  2. To create a test plan, click the down-arrow on the center group switcher and then click Testing Center.

  3. On the center group menu bar, click Plan.

  4. (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.

  5. Click Properties.

  6. 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.

  7. To select the build definition that is used to build your automated tests, click Build definition.

  8. 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.

    NoteNote

    For more information about build definitions and build quality, see Define Your Build Process.

  9. To save your changes, click Set build filter.

  10. 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.

  11. To close the Assign Build activity and return to the test plan properties, click the Close icon.

  12. To save these changes for this test plan, click Save on the toolbar.

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.

NoteNote

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

  1. To create a physical environment, follow the steps in this topic: Creating a Physical Environment to Use for Testing.

  2. 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.

  3. To create your test settings, follow the steps in this topic: Create Test Settings for Automated Tests as Part of a Test Plan.

To run the automated test using Microsoft Test Manager

  1. Open Microsoft Test Manager.

    NoteNote

    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.

  2. To run the automated test, click the down-arrow on the center group switcher and then click Testing Center.

  3. On the center group menu bar, click Test.

  4. (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.

    NoteNote

    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.

  5. 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.

    NoteNote

    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.

To view and update the test results

  1. Open Microsoft Test Manager.

    NoteNote

    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.

  2. To view the test results, click the down-arrow on the center group switcher and then click Testing Center.

  3. 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.

  4. Double-click a test run to open it and view the details.

    The test run details are displayed.

  5. (Optional) To update the title of your test run to be more meaningful, type the new name in Title.

  6. (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.

  7. (Optional) To add comments to the test result, click the Comments icon. Type your comments and then click Save comments.

  8. (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.

    NoteNote

    If, from your analysis, you determine that there is a bug, you can create a bug from this view.

  9. To save these changes for this test run, click Save in the toolbar.

Community Additions

ADD
Show:
© 2014 Microsoft