Loading

Working of data-driven Testing


Introduction :

The definition of data-driven testing can be defined as a way of running test scripts repeatedly, using data stored in some external file/storage location. Storage location can be any- a database, an XML file, a spreadsheet etc. Each time we need to run the test script, we may do so by using these input data iteratively. This way we can judge the efficiency of an application in handling various inputs.

A graphical view is the best form to understand any scenario. Let's have a look :

data driven testing

One more thing one needs to keep in consideration is the fact that, the data stored in external files that supports sequential storage, enables us to modify it easily. For example, in Microsoft Excel, data is stored in a tabular form, we have various sort mechanisms to store our data in a sequential order. Hence during the process of performing automation tests, one row may be selected or multiple rows. However , we need to mention which are the input values and which are the verifying values. The separation of input data from the test commands makes life simple, as the data is fetched from an external source and not from hard-coded values, makes it logically simple and easy to understand. When we have both input value and verifying data, data driven test performs the following set of operations.

  • Fetch data from the storage
  • Enter data in the application
  • Check/Verify results thus obtained
  • Move on to the next set of input data

Now, for carrying out an automation test with the help of external source, we have a tool that provides an efficient way to perform data-driven testing. Let us understand data-driven testing in the light of the tool named 'TestComplete'.

TestComplete offers the following ways to create data-driven tests.

  • DB Table Variables -These variables simply helps reading data from the data source. Data source may be an excel sheet or a CSV (comma-separated value) files. DB table basically stores the references to the data source and enables iterating through the data source sequentially, row-wise selection. We define a DB Table variable that access the records in the database table.
  • Table Variables -This is a mechanism for storing our 'test data' in a 2-D array, and then use this data in data-driven tests. We can store value of any type in this array (string, int, char , float etc.).
  • DDT Program Object -This object lets us create scripts, in case we wish to create custom test . This helps in fetching data easier in the manner, that we can traverse from the last record to the first and vice-versa.

Working of Data-Driven methodology for various storage devices :

  • In case we are using Excel to store our data, TestComplete tool provides a scripting object named , ExcelDriver, which is a scripting object that makes the process of iteration easy. It reads one row for one test run. Multiple rows are not supported.
  • DDT driver objects facilitates extraction of data from Microsoft ADO(ActiveX Data Object), excel sheets or CSV files. There are few DDT objects -
  • ADODriver - creates a driver for accessing a record set via Microsoft ADODB.
  • CSVDriver - for accessing data in CSV files.
  • ExcelDriver - lets us access excel data.

A test automation tool is simply a framework or in simple terms it can be thought of as a zone which has its own set of specifications. Automation tool has its own set of coding standards, ways to handle tests, etc.

Few test strategy guidelines :

  • Automation testing is a time consuming task. It demands significant amount of experience which is required in planning the design of the test scripts and also preparing the code for it.
  • The design of test lays down the what, how and when to use the input data, and clearly mention the expected results. The expected results are then compared with the actual results and deviations in results are noted down.
  • The test framework should be easy to use and maintain. A proper documentation is what comes at rescue. A detailed documentation of any framework/application helps one to develop a clear understanding about it.

Conclusion :

Hence data-driven automation testing facilitates creation of test scripts with a simplified logic. It definitely enhances test coverage also. The concept of using inputs from external data source proves to be an advantage. The major benefit that it offers is, one has the option of saving input values in any data source of their choice, as our automation framework offers the necessary drivers associated with a specific data source. Thus data-driven testing in automation is quite maintainable and efficient.