Data Driven Testing using Test Automation Testcomplete™

Page 1

Data – Driven testing using Testcomplete™ In Test Automation, Data driven frame work is a most effective frame work which gives more test coverage, with less effort. It becomes necessary for testing an application with different test data even in automation testing. While developing test automation for these types of application, Data-Driven frame work is best to use. General Approach for creating data driven test:     

Record (or develop) your test scenario with a set of test data in your tool. Create data storage (Excel, csv or data base) and in which give multiple values for each test data. Replace the values in the recorded script with proper variables. Write script to access a set of test data from the storage, and assign it to those variables. While executing the test these values will be used. Make a loop statement so that the test can be executed for all set of test data.

Testcomplete™ has many in-built features to develop Data- Driven test. Testcomplete™ gives easy access to the data storages like excel, csv, data base etc. Testcomplete™ has different scripting objects & methods to retrieve data from data storage. Even If we do not have scripting knowledge, we can use the Data-Driven Loop wizard to create DataDriven test. The following example demonstrates how to create data-driven test with Data-Driven Loop wizard for a key word test script. Here we are using excel sheet as our data storage. 1) Let us take the following key word test script. This test, logs-in into a login page by entering user name & password. Then it checks the welcome message is displayed or not.

Visit IVESIA’S WEBSITE Follow us at LINKEDIN and TWITTER


2) Now we will create a data driven loop for these two values (username & password) and execute this test for multiple login details. Let us say we want to execute the test using the following login details, which are stored in an excel sheet.

3) Now select the UserNameTextbox & PasswordTextbox rows in the keyword test editor & right click on it. From the menu select ‘Make Data Loop’ option.

4) Now it will open Data-Driven Loop window for inputting Variable name.

Visit IVESIA’S WEBSITE Follow us at LINKEDIN and TWITTER


5) Now select a Table type. Here we are using the excel sheet as data storage. So select the Excel Worksheet option and click Next.

6) Browse the source excel file containing Test Data from ‘Open File’ window and click Next button.

Visit IVESIA’S WEBSITE Follow us at LINKEDIN and TWITTER


7) Select the sheet name in which the data are stored from list shown .Also ensure that the ‘Treat first row as column names’ check box is checked. Then click Next button.

8) In ‘Select Records’ window choose ‘From the beginning’ and ‘To the End’ radio buttons. These two options are used to execute the test for all the rows in that

Visit IVESIA’S WEBSITE Follow us at LINKEDIN and TWITTER


sheet. If specific records only needs to used, then select record information. Click Next button.

9) In ‘Update Values’ window assign each columns of excel sheet to each values that needs to be parameterize. In our example, for UserNameTextbox field select the User Name column and for PasswordTextbox field select the Password column of our excel sheet. Then click Finish button.

Visit IVESIA’S WEBSITE Follow us at LINKEDIN and TWITTER


10) Now the command for Data Driven loop in the Keyword test editor will be seen. Also username & password values would have been replaced with the corresponding table variables.

Visit IVESIA’S WEBSITE Follow us at LINKEDIN and TWITTER


11) Now if this test runs, it will execute the login action multiple times with the data in that excel sheet & give results Note that here each row is treated as a set of test data. I.e. test data for a single execution should be kept in the same row of the excel sheet. For a single execution, If you want to use data from multiple rows, you cannot use this method.

Visit IVESIA’S WEBSITE Follow us at LINKEDIN and TWITTER


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.