Table of content

Data-Driven Test Case

DataDriver is an alternative approach to create Data-Driven Tests with the Robot Framework. DataDriver creates multiple test cases based on a test template and data content of a CSV or Excel file. All created tests share the same test sequence (keywords) and differ in the test data.

Because these tests are created on runtime only the template has to be specified within the robot test specification and the used data are specified in an external data file.

We have already written a Flight application test case, in that we used a keyword Login to flight application and we had actually given username and password in the test case itself. Now we have to convert this tets case into a data-driven test case by using the excel library keywords.

In the case of the keyword-driven test case, we were accessing the username and the password from the Login to flight application keyword, but in data-driven, you are going to access this information from the excel file.

Let us create a new Excel file by the name LoginData.xls and save this into Demo folder


So, we can access username and password cell value by using the excel library read keywords cell data by co-ordinates and the column count for username becomes 1,1 and the row count for password will become 2,1.

Now, go back to the flight application test case and delete the arguments which we have created before because the username and password will be automatically taken from the excel-sheet and update the Login to flight application keyword as shown below and I have declared username and password as global variable so that we can use these variables in any test cases.


Select the test case and run, once the test case starts executing, it will open the flight-application login page by using the username and password and closes the browser.

Q 1. How will you convert keyword-driven test cases into data-driven test cases? Explain with example.

Answer: Some test libraries are distributed with Robot Framework and these libraries are called standard libraries. The BuiltIn library is special because it is taken into use automatically and thus its keywords are always available. Other standard libraries need to be imported in the same way as any other libraries, but there is no need to install them. The available normal standard libraries are BuiltIn, Collections, DateTime, Dialogs, OperatingSystem, Process, Screenshot, String, Telnet, XML.

Q2. What are the 3 different types of variables in the Robot Framework?

Answer : Scalar variable, List variable, and Dictionary variable

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions