Saturday 19 October 2013

Keyword Driven Automation Framework

Here we are mainly focus on the keywords or function, but not in tets data.That means we create the function and mapped to the functionality of the application.


For example -

Suppose you have a Train reservation application which provides many features like

    * Login to the application
    * Search Train
    * Book Train tickets
    * Cancel Tickets
    * Fax Order
    * View Reports


To implement the keyword driven automation framework for this kind of application we will create functions in vbscript for each functionality mentioned above. We pass the test data and test object details to these functions.

What are the main components of keyword driven automation framework in QTP?

Each keyword driven automation framework has some common components as mentioned below.





As dispalyed in above image, We have 5 main components in keyword driven automation framework

    *
      Scripts Library (.vbs, .txt, .qfl)
    *
      OR - Object Repository
    *
      Test Data (generally in excel format)
    *
      QTP - Settings and Environment Variables
    *
      Reports - (Generally in HTML format)

We will see examples of each component in below section.



Library Scripts (Files) in keyword driven automation framework in QTP.


As I mentioned earlier, in keyword driven automation framework we develop the kewords(Function) that are mapped to the functionality of the application. In large automation projects  where there are many functionalities, We need to create lot of functions. Generally We create functions for each module in the application and store similar functions in seperate library files.

For example -

We can store login/logout related functions in authentication.vbs file.
All functions related to booking could be stored in booking.vbs

Please note that we can store library files with 3 extentions i.e. .vbs, .txt and .qfl.
QTP engineers prefer to store the library files in a file with extension .vbs as we can include vbs files using executefile statement and also find out the syntax errors by double clicking on the vbs file.
QFL file long form is Quick test function library.




Object Repository in keyword driven automation framework in QTP.

In QTP there are two types of Object Repository.

    * Local Object Repository (objectrepository.bdb for each action)
    * Shared Object Repository (.tsr extention)


We can store all the object property values and description saved in OR.

Out of these 2 object repositoryies, Shared object repository is very popular among QTP testers. Because we can have all test objects in single file. This helps us to maintain the object repository.

To add/ edit objects inside shared object repository, you must go to Object Repository Manager and open the .tsr file and then make the changes in the shared object repository.



Test Data (generally in excel format) in keyword driven automation framework in QTP.

All test cases data is stored in excel sheets. From QTP ,we read excel file and then row by row we execute the functions in a test case. Each test case is implemented as a set of keywords.
Common columns in Data sheet are mentioned below.

    *Test case ID - Stores the Test Case ID mapped to Manual Test Cases.
    *Test Case Name - Name of the Test cases/ Scenario.
    *Keyword - Mapped to function in library file.
    *ObjectInfo - Object types, Names and Values to be entered into those objects.
    *Misc Parameter - This is used to control the execution flow in the function.



QTP Test Settings and Environment Variables in keyword driven automation framework in QTP.

This is also one of the most important component of the keyword driven automation framework.
In Test settings We need to do some setting before we execute any test suite. This could be one time set up or per execution request set up.
List of Important Settings -

    *Object Synchronization timeout -
    *When Error Occurs during run session -
    *Resources - Associated library files
    *Environment - We need to set up some variables like folder path, User Id etc
    *Recovery - We must associate the recovery scenario file to the test. Recovery Scenario will handle unexpected events during execution. This will help for smooth execution using QTP.


Reports in keyword driven automation framework in QTP.


Reports are created in html formats using custom reporting function. We use filesystemobject to create html reports.
Reports will display the total number of test cases executed, Total Pass Test cases, Total Failed test cases and total time required to execute the test cases. This will give better picture of QTP Execution.

2 comments:

  1. "Hello,
    This is really great information found here, I really like your blog. Thanks very much for the share. Keep posting."

    PIC Scheme Singapore

    ReplyDelete
  2. Esta aplicación realmente ha tenido un impacto positivo en mi productividad; estoy agradecido por ello. Realmente encontré el sitio web CPS Test. útil para mejorar mi rendimiento en los juegos: ¡la precisión importa!

    ReplyDelete