Saturday, 14 August 2010

Data Driven Framework


Data-driven testing is the creation of interacting test scripts together with their related data results in a framework used for the methodology. In this framework, variables are used for both input values and output verification values: navigation through the program, reading of the data sources, and logging of test status and information are all coded in the test script. The logic executed in the script is dictated by the data values.

When to use?
If an application has too many screens which needs lot of input from user go for data driven framework.

Suggested Approach :
Step 1) Maintain test data for each screen of the ui in separate excel sheet, maintain a separate row of data for each test case and data for each test case should refer to the same row of all the sheets.
Step 2) Write a separate function for each screen which retrieves values from excel sheet and inputs data in to Application
Step3) In Main script, insert a calls to all the functions written in step2, initializing the rownumber of the excel sheet so that all functions gets  data from the same row of different sheets

Demonstration of Suggested Approach with example:
If there is a manual test case which has validation on ui or calculation at the screen 7 for example
1) Write a new main script, initialize row number to the row in excel sheet which maintains data needed for execution of test case.
2) Assuming that you have written individual function for each screen which gets data from different sheets, put the function calls as below

call func_screen1
call func_screen2
call func_screen3
call func_screen4
call func_screen5
call func_screen6

Write code for the screen 7 to perform verification on screen 7.

 Note:Don't put any validations in the functions apart from getting data from excel and inputting in to screens.

Advantages of using the Approach:

1)   Automation team need not know the functionality of complete application
2)  Even a starter in the team who has experience in tool, can quickly start working on the scripts
3)  Faster development of scripts