How to: Add Parameters to Shared Steps
If you have multiple test cases with shared test steps, you can create shared steps to use in all these test cases. This reduces the maintenance for manual test cases. For more information, see How to: Share Common Test Case Steps Using Shared Steps.
If you want to run your test cases that have shared steps multiple times with different data, you can add parameters to the shared steps. This enables you to run test cases with shared steps multiple times using each iteration of the data in the parameters. For example, if you have shared steps to log into an application then you might add parameters for username and password to run a test multiple times for users who have different permissions. You can add the parameters @username and @password to your shared steps. Then, in your test case you can add multiple values for these parameters depending on the requirements of the specific test.
When you add parameters to your shared steps, you only provide a single iteration of data for the parameters. This data iteration can be used if you want to create an action recording for this shared step. For more information, see How to: Create an Action Recording for Shared Steps.
If you do not provide data for the shared steps parameters in the test cases that include these shared steps, the data in the parameters of your shared steps will be used when you run your test.
Use the following procedure to insert or delete parameters and add the value for a parameter in your shared steps.
To insert or delete parameters and add the value for a parameter
Open Microsoft Test Manager.
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.
From the Testing Center, click Organize and then click Shared Steps Manager.
The Shared Steps Manager pane is displayed.
To add parameters to your shared steps, select the shared steps from the list.
To open the shared steps, click Open.
Click where you want to insert your parameter in either Action or Expected Result. Then click Insert parameter.
The Insert Parameter dialog box is displayed.
Type the name of your parameter and then click Insert parameter.
The parameter is displayed in the step preceded by @.
The column to add the parameter values for this new parameter is displayed underneath the steps in Default Parameter Value.
Repeat steps 5 to 7 to add all the parameters that you require for your shared steps.
To add the values for the parameters, click one of the columns for the parameters.
A new row is displayed to use to add a set of parameter values.
Type the values for all your parameters.
You can only enter one set of values for your parameters in your shared steps. These values are used only if you create an action recording for your shared steps. At any time, these will not be added to the test case that includes these shared steps. For more information, see How to: Create an Action Recording for Shared Steps.
(Optional) To delete a parameter from your shared steps, click the parameter in one of the rows in Parameter Values and then click Delete parameter.
The Delete parameter dialog box is displayed. You can replace the parameter with a fixed value or just remove it from your steps.
(Optional) To rename a parameter in your shared steps, click the parameter in one of the rows in Parameter Values and then click Rename parameter.
The Rename parameter dialog box is displayed. You can then change the name of your parameter throughout your shared steps.
To save the parameters and values that you have added to the test case, click Save in the toolbar.
To add data for the parameters to the test cases that include these shared steps, open the test case. The parameters are displayed underneath the test steps in Parameter Values. You can now add rows of data for each iteration of the test that you want to run. For more information about how to run the test, see How to: Run Multiple Iterations of a Test Using Different Data Parameters.