What is Data Driven test case and how is it used in automation

Data-driven test case iterates through the same steps but changes specific values each time. A simple example of that is a failed Login test case which tests for various ways user should have a valid error message on failed attempts. Using that example we would have 3 actions: Open Browser, Login and Verify Error Message. Since these 3 steps are always the same the only thing that changes for them is the data to cause various type of Login attempts, and that is when data driven component comes in to play. Instead of creating a new test case for each type of failure condition user would specify a different data for the step (eg: Login with username but not password, Login with invalid username, Login with valid username but invalid password, etc.) and this test case will iterate through all of it (effectively becoming multiple test cases).

Test Case Data

Opening Test Case and scrolling bellow Action Collection user will see a section called ‘Test Case Data’. Clicking to expand it will bring options to make this test cases in to a data driven one.

Adding Columns and Rows
Add Column – Will add a column which will be used as a data point reference in a Action Collection portion of a test case.
Add Row – Adds a Row. Each row will be an iteration for the test case execution.

Entering Value for a Row
In each String field user can specify a value they would like to be used for a column for that specific iteration. Each iteration is a horizontal line of values that will be used together in that run. In the screenshot example a first iteration will execute with a search value of ‘Star Wars blu’ and it will select item by index as ‘1’. Second iteration will use ‘Star Trek blu’ and ‘1’ and third iteration will be ‘Dune blu’ and ‘3’.

Specifying Test Case Data value in a Action Collection
To point test case Action to use a value from Test Case Data you would need to point at it similarly to specifying variable value but calling out TCData class first and then the name of the Column (eg: ${TCData.Name of column}). That value can be entered manually or be selected as a drop down value (which gets auto-generated after creating a Column). Using an above screenshot example we have created a column name ‘Movies’ which we want to use in our Search Amazon action, so for parameter ‘search for’ we have specified ${TCData.Movies} and now it will use the values from that column.

Deleting Rows and Columns
Delete Row – Click on the red delete button next to a row that user wants to delete.
Delete Column – Right click on column name user wants to delete and select Delete Column.

Data Driven Test Case in Execution
Every time ANY type of modification is made in Test Case Data user is required to click on Data Refresh button in Execution in order to use new values (even if execution was closed and opened again). Please go here to see how Data Driven test case is used in execution.

Feedback

Thanks for your feedback.

Post your comment on this topic.

Please do not use this for support questions.
For customer support, please contact us here.

Post Comment