Site icon Vinsguru

QTP/UFT – Hybrid Test Automation Framework

There are 4 most popularly used automation frameworks.

  1. Modular
  2. Data driven
  3. Keyword Driven
  4. Hybrid

First 3 frameworks have their own pros and cons. Hybrid framework is the combination of all 3 by using all the pros and minimizing the cons.

In this post, I would like to show how I have implemented my hybrid automation framework using QTP for one of the projects.

Folder Structure:

My folder structure is as given below.

Lib Folder:

If I need to create some libraries which is not going to be application dependent, then i write that in .net instead of VBScript. Because We can write better code in .Net, it runs faster, has many reusable libraries, OOPs support, better error handling than VBScript.

Ex: I have below utilities created.

Properties Folder:

This folder contains a default properties file & an environment specific property file.

 

Each property is set as Environment Variable for QTP.

Functions Folder:

These are all application specific business actions written in VBScript.

Ex: I have below action keywords to execute some business functionalities specific to my application under test.

Above high level business action/keywords are QTP/Selenium automated test scripts. Whenever these keywords are called, the corresponding test script is executed.

For Ex: It could be something like this.

Function CREATE_ORDER

' select product for the given product code
' click on order button
' enter payment details
' checkout
' check for the conformation

End Function

Tests Folder:

It contains a spreadsheet in which we add the automated test cases.

TestCase sheet:

It contains list of all the testcases for the application. It contains the test case ID, test description & corresponding business actions to be executed. By calling these actions in the given sequence, we get the business flow verified.

For Ex: For TC001, We need to create an user & order a product. So we call 2 actions – CREATE_USER & CREATE_ORDER. To order different products, the same function is called as the business flow is same and only the product is different (Data-driven). So we create another test case, TC002 – We call those 2 actions again.
To get the testdata for the action, driver reads action-data mapping sheet.
For Ex: Below sheet shows that for CREATE_ORDER business action , it can find the test data in the ‘OrderInformation’ sheet.


Driver goes to ‘OrderInformation’ sheet and gets the test data from this sheet by using the testcase ID.  In the below image, TC001 & TC002 have different test data. Eventhough TC001 and TC002 have the actions, they use different test data and tests different products.

 

Suite Folder:

Test case spreadsheet contains all the possible test cases for the application. Suite file contains group of test cases to be executed for a functionality.

For ex: I might have 1000 automated test cases in total from different modules of the application. But i might be interested in running only 100 testcases specific to ‘order’ module as there could be a recent change in the particular module of the application. So i create a suite file which contains only order related cases to execute.

Sample Suite File:

                               

 

How It Works:

It invokes the QTP using its Automation Object Model & loads the environment variables, starts running the QTP – It also keeps monitoring the execution, logs the results in the console.

Check here to log QTP result in the console.

Report:

The report utility creates a nice HTML as shown here. [I created the .net library to create the HTML report – but I used a CSS file to format the HTML from a blog long back. I forgot the site. Credit for the css should go there]

 

Notification:

Once the execution is complete, It sends out a detailed information to the email addresses given in the property files. I use Jenkins plugin to send the emails. I also use another Jenkins plugin to send SMS notifications to your mobile device.

Summary

My aim was to give you a high level idea about the hybrid automation framework I have implemented. Please leave a comment in case of any questions / suggestions.

If you are interested in implementing something similar for your organization, Please refer to below posts of TestAutomationGuru.

 

 

Share This:

Exit mobile version