Share via


Microsoft Test Runner series – part 6 - Shared Steps

Hi Again,

Let’s talk about an important concept in test case design – reusability. As testers you know that there are few steps that may be common in many test cases e.g. steps to log into the application may be common to multiple test cases. In other cases the cleanup steps (or any other steps in between) can be common. These steps have to be authored as part of these test cases. If something changes in these common steps, (e.g. steps to login have now changed) many tests have to be altered.

MTLM uses the concept of shared steps to make it easy to handle such scenarios. Steps that are common (or shared) between multiple test cases can be written as shared steps. Shared steps look like a mini test case & can be imported into any test case at any point (not necessarily at the start or end of test case). When imported into a test case, while executing that test, MTR shows the steps as any other steps in the test. The steps can be action step Or can be validate steps (with expected results).

Author shared step

Sometimes, author does not anticipate shared steps & realizes later that these steps are being used in many places. In these scenarios, MTLM makes is possible to select a number of steps of a test case & convert into a shared step (using context menu). A new shared step is created & saved in the repository. From now on, any other test case can reference it.

Next natural question is what happens to shared steps in a fast forwarding scenario: When tester is running the test (& have selected to record actions), the actions of the shared steps are also saved. The extra advantage is that the recorded actions are associated with the shared steps. Now the shared steps has associated action recording. User can fast forward the actions of the shared steps at any time. Not just in the test case it was recorded, but also in any other test case where the shared step is being referenced.

When the steps of the shared step changes (e.g. for login), just re-record actions for the shared step in one test case & all other test cases automatically get the benefit.

For some users, it seems more convenient to use the concept of shared steps as a component library. MTLM not only allows shared steps to be authored, just like a mini test case, users can also create action recording for a shared step without adding it to a test case first. This can be achieved by going to the shared step tab in MTLM & choosing to create actions recording for a shared step. It launches MTR in a special mode for this purpose only.

Note that shared steps cannot be executed by itself & does not have a result. They have to be executed as part of a test case.

Shared steps can also have parameters just like any other step. However, as they cannot be executed by themselves, so they cannot have associated data for testing. When imported into a test case, the test case automatically shows extra columns for parameters used in the shared steps. This way, different test cases can be authored that supply different data sets to be used in the common steps.

Please note that although shared steps can’t be executed & need any associated data, adding one row of data is possible with shared step. You may want to provide this single row of data if you plan to create action recording for the test case without adding it to any test case (i.e. recording shared steps in standalone mode of MTR as described earlier). This allows the tester to create action recording with correct binding between the parameters & the controls on the application. Other than that there is no use of this single row of data & is ignored when shared step is added to the test case.

So go ahead, divide your test cases in reusable sections & reuse these shared steps to gain flexibility & productivity.

Other links:

- Using Shared steps

- Video ALM 5 - Author test and shared steps

 

Thanks

Suresh Budhiraja

Sr. Program Manager