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: Choose the applications that are recorded in a manual test.
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.
Requirements
- Visual Studio Ultimate, Visual Studio Premium, Visual Studio Test Professional
To use recorded actions to create test cases
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, choose Start, and then choose All Programs. Point to Microsoft Visual Studio 2012 and then choose Microsoft Test Manager.
From the Testing Center, choose Plan and then choose Contents.
The Contents pane is displayed.
Select the test suite in the test suite hierarchy pane that you want to add test cases to, and then choose New.
The New Test Case dialog box is displayed.
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.
Update the other test case fields as required.
For more information about the other fields, see How to: Create a Manual Test Case.
Choose Steps and then choose <Click here to add a step>.
Add one test step under Action, type the action to create test steps.
To save the test case, choose Save and Close.
To create a test settings to use to run this test, locate the Lab Center, choose Test Settings, and then choose New.
The Test Settings dialog box is displayed.
In Name, type Create Action Log.
Under What type of tests do you want to run, select Manual.
Under Steps, select Roles and verify that Local is selected under Sets of roles.
Choose the Data and Diagnostics step and select Actions and clear all other items. Then choose Configure next to Actions.
The Configure Diagnostic Data Adapter - Actions dialog box is displayed.
Select Applications in the following list and then enter the process name for your application under test.
To save the test settings, choose Save.
To apply the new test settings for the test, from the Testing Center, choose Plan and then choose Properties.
Under Manual runs, choose the Test Settings drop-down list and select your Create Action Log test settings.
Choose the Test tab in the Testing Center and then choose Run Tests.
Select the test suite that contains the test you want to run.
Open the shortcut menu on the test shown in the list of tests and point to Run.
The Test Runner is displayed.
Choose Start test and then perform the UI actions for your application that you want to save into your action log.
When you have completed the actions, mark the test step with a state of Pass and then choose End Test.
The action log files are shown in the Attachments and bugs drop-down list.
Choose the file to display the action steps that were performed during the test.
Optional: To reset the test, choose Reset on the toolbar in the Test Runner activity.
Optional: To modify the test case, close Test Runner and in Microsoft Test Manager choose Plan and then choose 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.
Open the shortcut menu on <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.
Remove the original test step that you added to use to create the action log.
(Optional) Add expected results for the test steps as required.
To save the test steps that you added to the test, choose Save and Close.