Data Driven Approach: In Automation testing
Data driven approach advocates externalizing the test data from the test automation tool (usually into an Excel sheet; Databases, XML files or other data sources may be used as well), to improve the maintainability of test data. It is aimed at helping business users to manipulate the test data without having to modify the actual scripts. It is also helpful when we need to drive a test script with multiple sets of input data. For example: running the same script for different roles/user id’s.
Pros:
· Avoids hard-coding of test data in the scripts
· Non-technical users can easily change the test data using the Excel sheets, without modifying the scripts in any way
· The same script can easily be executed with multiple rows of test data
· Reasonably simple to implement
Cons:
· Provide features for non technical business users to interact with the framework
Demonstration on parameterizing data using QTP Datasheet
Step 1 - Go to Automation à Record and Run Settings, and open the ch1blogs site in a new IE Browser.
Step 2 - Click on Automation à Record/F3/ Record from the Tool bar.
Based on Step 1 perform the following operations –
· An IE browser opens up with the URL https:\\ch1blogs
· A User Authentication window pops up asking the user to enter the User Id and Password
· Enter the details and the user is navigated to Blogs Home Page.
· Click on Explore à View My Blog which navigates the user to the Blog Site page.
When you see the same in the script, (QTP – Explore View), the operations are recorded with hardcoded values for User Id and Password.
User name is the User Id entered and Password is the encrypted version of the Password entered during recording.
If we hard code these values, we cannot run the same script on several sets of data. Hence we need to parameterize these values.
Data Drive the values using QTP Datasheet
Step 1 – Go to Tools à Data Driver…
The following window will be displayed with all hard coded values.
In my case User Id and Password are the hardcoded values and hence the value of “Constants” is 1(since it is a Constant Value) and the value of “Parameterized” is 0, since the value is not Parameterized yet.
Step 2 - Click Parameterize… Select Parameterization Type window appears as below.
Step 3 –
Step 4 –
Step 5 –
(The left screen below gives the Name, generated by the tool and LoginId (name in the right screen) is the name given by the user.
Step 6 –
Step 7 – Click OK
Step 8 –
Step 9 –
Step 10 – Click OK
Step 11 –
· Several iterations can be performed with same or different sets of data.
Post a Comment