An approach to build a keyword driven framework

Wednesday, December 3, 2008

Keyword driven framework:

Any framework should consist of following mandatory information

  • It should be Flexible
  • Less changes in the scripts when the requirement changes that is maintainable
  • Should be more structured.
  • There should be centralized automation team dedicated to functional automation of the project
  • Creating right function on right time
  • Good coordination between functional testing team as well as automation testing team
  • Maintenance: Never ending part on the automation life cycle front.

Now a day’s all the organizations are moving to the web based application rather than client server or mainframe application. The World Wide Web is moving to become micro. So it makes the business sense to adopt keyword driven framework for web based application though it is a bit tough for the implementation as TTC (time to code) is more than the other framework.

A good keyword driven automation framework is one which can be used across the web based application. Whenever we need to build the automation framework we do not have to start from the scratch and we can do that by building the blocks on the existing keyword driven framework.

Framework structure:

1. Application scenarios:

Application scenarios are the ones which has the description of the object, operation to be performed and keyword description of the object. It is a file from where the QTP will recognize the object and will perform the action, It can act as a test scenario documentation which has the easily understandable language that is used for the keyword and we can save time, effort and cost for preparing the same.

Example: Let us say that there are three edit boxes named Login name, Password and date of birth (DOB) respectively. The keyword Login can be used as a keyword on any page to enter the login information. We need to create a function to access the log in the parameters to make the function call appropriate. Moreover we can make the keyword reusable by making function reusable.

The best practice is any function has to be reusable if not then write inside the script.

2. Database set ups and files

The test data can be stored in the MS Access or any other database. The best practice to design the database is to have one table for each screen along with the test case ID and the test case name, These fields are important as these are recognizing the test cases that are automated.

3. Driver Script

Driver script is important script in every framework; it is the next step after the initialization of the scripts and database setup and connectivity with the application. This will be having function calls for all the reusable function that has been written.

4. Function Library

Function library is the repository of all the reusable functions available for the project. The keyword driven approach is having all the logic of the automation in the VB script functions. No scripting is done outside the function library. Any Keyword driven framework will be having two function libraries

  1. Application specific function
  2. Application independent or reusable function

Function library might have a function which gives call to the other functions across function library folder but that is the only function might present outside the function library.

Reusable function examples:

  • Click on the drop down box
  • Click on the save button
  • Close dialog box

5. Initialization VB script files:

This file will be having all the data related to the execution environment as well as the test data. It will set the browser options if necessary and all the basic things that might be required at the time of execution of the scripts.

Initialization file example:

  • Set the connectivity to the database
  • Load environmental setting file
  • Set the path of the object repository

6. Object repository:

.mtr (If used shared object repository) or .tsr (if used local object repository) files will be stored in this folder.

7. Sequence files:

Sequence file is combination of the initialization as well as configuration; here the configuration is basically about the test scenario or the test case execution. The sequence file is stored as the excel file and from that one can recognize how the test scenario will be executed, there might be many instance where one does not want to execute certain test cases and want to omit it. For that purpose there is a flag set in the excel sheet and it will be interpreted accordingly. Location of the sequence file can be in the root directory or in the initialization folder.

Example of the sequence file:

Good Bye for now, Take care.

" Everything really interesting that happens in software projects eventually comes down to people."- James Bach

0 Responses to "An approach to build a keyword driven framework"