What is Data Driven Framework and How It Works ? - TestingQ.com

-->Exclusive Portal for Testing Jobs

What is Data Driven Framework and How It Works ?

As the name suggests, Data Driven Testing Framework is a framework which is driven by test data, which means that test data is the important factor here. The basic expectation with this kind of test automation framework is that your test scripts should be built in such a way that it should work for different sets of data without any changes to the test script.

Consider a scenario where you have a large number of user credentials for an application. You need to login to the application with each of these credentials to find out which of the user credentials are working properly and which are not. In order to complete this task, you can create a script in QTP which would read each of the user credentials and try to login to the application and at the end would report the results.


What is the basic approach used to create a Data Driven Framework?
If you would have noticed in the previous articles on Linear and Modular Automation Frameworks, the test scripts were written in a way where the test data was “hard-coded” with the test script. i.e. the data and the script were together as a single unit. Now try to superimpose this approach on the scenario (checking multiple login credentials) we discussed above. If you were to use this approach on the above scenario, you would need to change the test data in the script after each run which is not such a good idea because the basic premise of automation is “you have to aim for least amount of manual intervention possible”.


There is one more important point to be considered here. You would have noticed that QTP experts are involved in creating the test scripts and many a times manual testing team is given the job of running the scripts for regression and other purposes. Mostly they would not be having much idea about how to use QTP and hence it will be difficult for them to go through the code and change the test data. This process might leads to some errors also if things are not done properly. Because of this, “code + data” together as a one unit doesn’t work out very well.


So now lets come back to the point. What is the approach to create a data driven framework? In simple terms, all you have to do is to just separate your code and data. And your Data Driven Framework is ready. You would have to store your data in some external files (such as text files, excel, database etc) and figure out a way to read the data from this external source and pass it to your application through some variables. That’s all..

What are the different Data Sources that can be used in QTP?
QTP supports a wide variety of Data Sources from where you can extract data for your test scripts. Some of these are -
1) Microsoft Excel
2) Text files
3) XML files
4) Databases like SQL, Oracle etc
5) and many more…

Although there are many data sources that you can use with the QTP test scripts, the data source that is used almost all the times is Microsoft Excel. In most of the applications that you would be automating, you would be taking data from excel only.

However there are many cases where you would be using some different data sources also. For example, if you are working on an end to end billing application, many a times the product and billing information are stored in XMLs. So in these type of scenarios, your primary data source will be xml.
There would also be many cases where you would need to use more than one data source.For example, in the above scenario, xmls will be your primary data source but you can use excel sheet also to save login credentials, URLs etc of the application. So excel in this case would be the secondary data source.




To receive daily posted JOBS & Interview Questions
Just enter your email address below and click 'Submit'
Enter your email address:

Make sure to activate your subscription by clicking on the activation link sent to your email