Microsoft Test Runner series – part 5 – Data Driving

Hi again,

Today we will talk about data driving a test. As is very clear to all testers, if a test requires some data input in AUT, it should be tested with different data sets (e.g. verify that the application works with boundary conditions, wrong data, etc…). Different teams use different mechanism to represent the data set relationships.

In MTLM, a test case can have data sets associated with it. While authoring a test, user can add parameters in the step (a parameter name would start with @). Associated data sets can be defined in the test. Each data set will become an iteration of the test when loaded in MTR.

Authoring Data driving test

Data driving manual tests: When tester is testing the first iteration, MTR, not only shows the step, but also shows the data that should be used while testing this iteration. When next iteration is loaded, the steps remain the same; however data shown is for the next data set. This way tester can know that they have tested the test case with all the data sets.

Executing data driven test

Parameters can not only be used in test step (instruction), but can also be used in expected result.

When tester selects a step that has some parameters in it, the step shows the data for each parameter. It selects the first parameter by default (shown by an arrow next to it). It also copies the data associated with this parameter in the clipboard. When tester is in the control where data needs to be entered, she can simply paste the data & move to the next control. If the tester had selected to create action recording, the tool figures out that the data has been used & selects the next parameter in the step, also copies this data on the clipboard.

Hence it is possible to fill a long form quickly, by simply doing CTRL V, Tab, CTRL V, CTRL V Tab…. Wow that makes the data entry so easy J.

If in some case tester wants to enter a different parameter value in the control (may be the sequence of control was changed in the UI), user can also select the parameter by clicking on it & that parameter becomes the current parameter (& hence the value is copied to the clipboard).

Fast forwarding a data driven test: As we discussed in previous blog, fast forwarding helps testers quickly reach the step that they are interested in paying more attention. We also know that the fast forwarding plays back the same actions that were recorded earlier. So how would data driving scenario work with fast forwarding?

When tester tests a test case manually & reaches a step where data entry is required, as we saw earlier, tool shows the data that tester is suppose to enter. Tester can enter this data by typing it in the control Or by pasting is (as the data is already available on the clipboard). In Either case, the recorder is intelligent enough to recognize that the data has been used. If the data typed or pasted matches the data that parameter had, it makes a relationship between the parameter & the control. Hence the recording is not a simple action recording any more, it actually records a parameterized action.

During fast forwarding when playback reaches this parameterized action, it automatically picks up the data from the current iteration & pastes it in the control. So it is possible for tester to record actions while testing with a data set & fast forward using a different data set without doing any extra effort.

Cool huh…

Try it now, select first iteration, perform manual testing. Finish this test case. Select next iteration, play the steps, watch it using the data from second iteration. It will make the testing easy, just record the first iteration, use “Play All” for second iteration, third iteration, fourth,……

Helpful tips:

- For binding to happen correctly, make sure that you select the step, before typing the data in the AUT

- Correct the bindings if needed, before you mark the step result (the bound icon will show up next to the parameter to tell that that the control has been successfully bound).

- Choose an iteration that has data for all the parameters while recording; this will make sure you get binding for all parameters.

- While recording make sure to set the value in the control that needs to be bound (if the data is already present in the control, please delete it & paste again).

Other links:

- Various videos referred in previous blogs shows how to author a data driven test & use it.



Suresh Budhiraja

Sr. Program Manager

Comments (1)

  1. Ehsan karim says:

    Respected sir, very nice effort and well explanatory series of articles i found for project we are working on.

    I would like to ask, how the expected results and data sets are managed ? I would be thankful if you please describe how it is managed in MTM or

    give your suggestions how better it can be managed?

    Thanks agian.

Skip to main content