Sdílet prostřednictvím


How to: Use Recorded Actions to Create Test Cases

When you run a test case using Test Runner from Microsoft Test Manager, you can create an action log that stores each action that you performed with the UI for the application under test as text in a file. For more information about how to create an action log, see How to: Record User Interface Actions for Manual Tests Using Test Settings.

You can use this file to create the steps in your test cases, or to give you a quick start for creating the steps, without having to retype each action. For example, you could create a test case, Add Item to Shopping Cart, with just one test step named Create Test Steps. By using test settings to collect the action log, you can then run that test and perform all the necessary actions to add an item to your shopping cart. Each UI action is stored in the action log when you end the test. You can take this text in the action log file and copy the data to Microsoft Excel, and then modify the data and copy and paste this into your test case to create your test steps.

To use recorded actions to create test cases

  1. Open Microsoft Test Manager.

    Poznámka

    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. From the Testing Center, click Plan and then click Contents.

    The Contents pane is displayed.

  3. Select the test suite in the test suite hierarchy pane that you want to add test cases to, and then click New.

    The New Test Case dialog box is displayed.

  4. To name the test case, type the name in Title.

    You use this title to identify the test case and search for it if you have to.

  5. Update the other test case fields as required.

    For more information about the other fields, see How to: Create a Manual Test Case.

  6. Click Steps and then click <Click here to add a step>.

  7. Add one test step under Action, type the action to create test steps.

  8. To save the test case, click Save and Close.

  9. To create a test settings to use to run this test, locate the Lab Center, click Test Settings, and then click New.

    The Test Settings dialog box is displayed.

  10. In Title, type Create Action Log.

  11. Select On a local test machine only.

  12. Click Data and Diagnostics and select Action Log and Recording and clear all other items. Then click Configure next to Action Log and Recording.

    The Configure Action Log and Recording dialog box is displayed.

  13. Select UI Action Log and clear Action Recording.

  14. Select Record only the UI actions for the applications in the following list and then enter the process name for your application under test.

  15. To save the test settings, click Save.

  16. To run the test, from the Testing Center, click Test and then click Run Tests.

  17. Select the test suite that contains the test you want to run.

  18. Click Settings, located at the bottom of the Run Tests pane, to select your Create Action Log test settings.

  19. Right-click the test shown in the list of tests and point to Run.

    The Test Runner is displayed.

  20. Click Start test and then perform the UI actions for your application that you want to save into your action log.

  21. When you have completed the actions, mark the test step with a state of Pass and then click End Test.

    The action log file is shown in the list following Attachments in the Properties - Test Results tab.

  22. Right-click the file and then point to Open with. Open the file by using Microsoft Excel.

  23. Edit the cells in the spreadsheet to remove any actions that you do not want in the steps for your test case.

  24. To return to the Run Tests activity, click Restore on the toolbar in the Test Runner activity.

  25. To modify the test case, click Plan and then click Contents. Select the test suite for the test case in the test suite hierarchy and then double-click the test case in the test suite details pane to open it.

  26. Right-click <Click here to add a step> and then point to Paste.

    The actions you selected from the action log are added as actions to the test steps.

  27. Remove the original test step that you added to use to create the action log.

  28. (Optional) Add expected results for the test steps as required.

  29. To save the test steps that you added to the test, click Save and Close.

See Also

Tasks

How to: Run Manual Tests

Concepts

Creating Manual Test Cases