qtp automation framework for web based appln

27
  Automation Framework Design for Web Based Applications V ersion 1.0 Version 1.0 Document: Automation Framework Page: 1 of 27

Upload: jayaram-dongar

Post on 13-Jul-2015

299 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 1/27

 

Automation Framework Design

for Web Based Applications

Version 1.0

Version 1.0

Document: Automation Framework Page: 1 of 27

Page 2: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 2/27

 

Document Summary

Revision History

RevisionNumber 

RevisionDate

Revision Details Revised By Approved By

Version 1.0

Document: Automation Framework Page: 2 of 27

Page 3: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 3/27

 

Contents1. Introduction ...................................................................................................................5

1.1 Purpose..............................................................................................................................................5

1.2 Automation process............................................................................................................................5

2. Approach........................................................................................................................6

2.1 Automation Framework.................................................................................................................... ..6

2.2 Types of Automation Frameworks.....................................................................................................6

2.3 Framework Structure for -Web based Application: ..........................................................................7

Test cases should be automated by QTP automation tool......................................................... .............7

Test scripts should be executed through QC...........................................................................................7

Common components should be handled by Standard Libraries............................................................7

The script should be used for various releases without major modifications...........................................7

Minor changes in the releases can be handled without modifying the script...........................................7

Can be maintained by common user without knowing the coding details................................. .............7

It should be capable of creating multiple accounts eg: Multiple CIF ids.......................................... ........7

The framework should support QTP and QC as already these tools were available...............................7

The Keyword Driven Framework is selected by considering above requirement as it has the followingcapabilities of Web based application............................................................................................ ........7

QTP & QC framework Structure for Web based Application:.................................................................8

The following diagram represents the compatible structure with Web based application and QTP & QC.. .8

2.4 Folder Structure in QC:.............................................................................................................. ........8

2.5 Test Scenario Folder:.................................................................................................................... .....9

2.6 Test Script Folder:............................................................................................................................10

2.7 Object Repository:............................................................................................................................11

2.8 Recovery Scenario Folder:...............................................................................................................13

2.9 Library Function Folder:......................................................................................................... ..........14

2.10 Common Functions Execution Method:..........................................................................................16

2.11 Test Script Execution:.....................................................................................................................17

3. Settings in QC and QTP:.............................................................................................19

3.1 QTP and Quality Center Integration.................................................................................................20

3.2 Connecting to Quality Center ...................................................................................................... ....21

3.3 Saving test to a Quality Center Project ............................................................................................21

3.4 Running QTP Scripts from QC ........................................................................................................22

3.5 Scheduling Test run from QC...........................................................................................................23

Version 1.0

Document: Automation Framework Page: 3 of 27

Page 4: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 4/27

 

4. Scripting Standards –Naming Conventions.................................................................25

4.1 Test Script Naming ........................................................................................................................ ..25

4.2 Function Naming............................................................................................................................ ..25

4.3 Data table naming Conventions.......................................................................................................25

4.4 Variable Naming Conventions..........................................................................................................26

4.5 Script Header Template....................................................................................................................26

Version 1.0

Document: Automation Framework Page: 4 of 27

Page 5: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 5/27

 

1. Introduction

The overall objective of the automation framework carried out for Web based applications testing is to

establish the automation of manual testing.

1.1 Purpose

The purpose of this document is to provide an overview of the Test Automation Framework for Web basedapplication and to ensure a successful outcome of automation scripts and provides the base for allsubsequent testing tasks. This process provides a streamlined methodology for effective test automation.This accelerates an optimistic approach, which leads to Maintainability and Reusability of scripts for Webbased application. This framework design will holds good for all releases.

1.2 Automation process

Approach for automated testing project is to capture the scripts using Quick Test Pro (QTP) once somestability has been confirmed in the scripts. Script must be capable of running on different test / developmentenvironments. The following diagram explains the different phases involved in Test automation process.

Version 1.0

Document: Automation Framework Page: 5 of 27

Page 6: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 6/27

 

2. ApproachAs there are no automation framework for Web based application, IBM proposed for an automationframework to automate manual test cases. This framework ensures the automation requirement for Web

based application.

2.1 Automation Framework

This framework is an attempt to simplify and speed up scripting by making use of reusability. It is a tieredorganization of the function libraries. The functions are organized into separate libraries, to help in keepingthe functions more managed, thus ensuring reusability.

Business scenarios are identified for each module/screen. Each business scenario has several distinctprocesses like adding a new customer detail and adding a new account detail. Each process defines anactivity. This activity is referred as an action. Each action is drilled-down to the lowest level task. A navigationstep in the application constitutes a task. Each task defines a function in the function library and since these

tasks can be repetitive, the functions are reusable.

Several such tasks then constitute an action. Since some of the actions are common across the application,these actions can also be reused.

This approach not only makes a complex process modular but also ensures reusability.

2.2 Types of Automation Frameworks

There are many frameworks available for the various industry requirements. Hereby 4 types of framework

that are proven in automating various applications.

1. Keyword Driven Framework 

Keyword-driven testing and table-driven testing are interchangeable terms that refer to an application-independent automation framework. This framework requires the development of data tables and keywords,independent of the test automation tool used to execute them and the test script code that "drives" theapplication-under-test and the data. Keyword-driven tests look very similar to manual test cases. In akeyword-driven test, the functionality of the application-under-test is documented in a table as well as in step-by-step instructions for each test.

2. Data-driven testing

Data-driven testing is a framework where test input and output values are read from data files (data pools,ODBC sources, CSV files, Excel files, DAO objects, ADO objects, and such) and are loaded into variables incaptured or manually coded scripts. In this framework, variables are used for both input values and outputverification values. Navigation through the program, reading of the data files, and logging of test status andinformation are all coded in the test script.

Version 1.0

Document: Automation Framework Page: 6 of 27

Page 7: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 7/27

 

3. Modularity-driven testing

The test script modularity framework requires the creation of small, independent scripts that representmodules, sections, and functions of the application-under-test. These small scripts are then used in a

hierarchical fashion to construct larger tests, realizing a particular test case

4. Hybrid Test

The framework is a combination of all of the above techniques, pulling from their strengths and trying tomitigate their weaknesses. This hybrid test automation framework is what most frameworks evolve into over time and multiple projects.

2.3 Framework Structure for -Web based Application:

We suggest that Keyword Driven Framework with QTP and QC is capable to support the automation of Web

based application for their requirements.

Requirement:

• Test cases should be automated by QTP automation tool

• Test scripts should be executed through QC

• Common components should be handled by Standard Libraries

• The script should be used for various releases without major modifications

• Minor changes in the releases can be handled without modifying the script

Can be maintained by common user without knowing the coding details

• It should be capable of creating multiple accounts eg: Multiple CIF ids.

• The framework should support QTP and QC as already these tools were available

Selection of Framework:

The Keyword Driven Framework is selected by considering above requirement as it has thefollowing capabilities of Web based application

• This framework supports automation of Web based application using QTP and QC

• This framework supports the common code for all objects in the Web based application

• The same script can be used for various releases without major modifications

• The script is capable of creating multiple data related to scenarios like creation of CIF ids,Creation of Savings accounts, etc.

• Other than Common scripts all the other scripts are created and maintained in Excel. Anynew objects in new enhancements can be added in excel instead of modifying the code.

Version 1.0

Document: Automation Framework Page: 7 of 27

Page 8: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 8/27

 

• Can be accessed by common user with the knowledge of excel

QTP & QC framework Structure for Web based Application:

The following diagram represents the compatible structure with Web based application and QTP & QC.

…….. Folder Structure

 

2.4 Folder Structure in QC:

The following folders are created in Quality Center under Test Plan for Web based application:

1. Test Scenario Folder 

2. Test Script Folder 

3. Object Repository

4. Recovery Scenario

5. Library Function

The details of each folder is explained in the below sections.

Version 1.0

Document: Automation Framework Page: 8 of 27

Quality Center 

Test Scenario

RecoveryScenario

ObjectRepository

Test Script

Functions

Page 9: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 9/27

 

QC Folder Structure in Test Plan Folder 

2.5 Test Scenario Folder:

This folder contains the excel sheets of Keywords scripts using by QTP and QC for Web based application

Eg: The Keyword Script for Login Scenarios is attached herewith;

C:\Documents andSettings\subrams9\Deskt

C:\Documents andSettings\subrams9\Deskt

Version 1.0

Document: Automation Framework Page: 9 of 27

Page 10: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 10/27

 

In this file the name of the objects in that Login page is converted as Keywords and the test data for thoseobjects are also incorporated.

Keyword Excel in Test Scenario Folder 

2.6 Test Script Folder:

This folder contains the test scripts for each manual test case. This script contains the coding for each objectin the Web based application as a function call and this will be called based on the object selected in theapplication at the time of execution.

Initially these scripts are created in the Test Plan folder and the same will be moved to Test Lab folder at thetime of executing the scripts.

Version 1.0

Document: Automation Framework Page: 10 of 27

Page 11: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 11/27

 

All the test scripts will be executed in the Test Lab folder in QC.

2.7 Object Repository:Object: An Object is a graphic user element in an application. Eg: a button or a list or an edit box or animage, etc...

The special characteristics of an object within the Quick Test are called Object properties. QTP stores therecorded object properties in a folder called Object Repository.

Object Repositories are of two types Local and Shared.

If objects are stored in a Local Object Repository then these are available to specific actions but not to all theactions. But if these objects are stored in one or more Shared Object Repositories then multiple actions or test can use them.

In Web based Automation, we use Shared Object Repositories so that same objects in different modules canuse the same Object Repository and this will eliminate the redundancy of OR and saves the memory space.

QTP finds the Object in Object Repository using object Logical Name and Object Hierarchy. QTP retrievesTest Object properties from OR and QTP searches actual application for the Object with the same propertiesas the OR Test Object and performs user action

Version 1.0

Document: Automation Framework Page: 11 of 27

Page 12: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 12/27

 

In Quality Center Object Repository file is stored in a Folder under Test Plan as follows:

This folder contains all the objects details related to the application and will be used as Shared ObjectRepository as .tsr file.

Version 1.0

Document: Automation Framework Page: 12 of 27

Page 13: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 13/27

 

Object Repository File in OR folder 

2.8 Recovery Scenario Folder:

Unexpected events, errors, and Web based application crashes during a run session can disrupt our runsession and distort results. This is a problem particularly when tests run unattended; the test pauses until weperform the operation needed to recover. To handle situations such as these, QTP enables us to createrecovery scenarios and associate them with the specific tests. Recovery scenarios activate specific recoveryoperations when trigger events occur.

There are 3 steps to handle the exceptions:

1. Trigger event: - Pop-up window, Object state, test run error and application crash. This is the eventthat interrupts our run session.

2. Recovery Operations: - It is an operation to perform to enable QTP to continue running the test after the trigger event interrupts the run session. For example, clicking an IK button in a pop-up window, or restarting Microsoft Windows.

3. Post Recovery: - It is the instructions on how QTP should proceed after the recovery operationshave been performed, and from which point in the test QTP should continue. For example, we may

Version 1.0

Document: Automation Framework Page: 13 of 27

Page 14: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 14/27

 

want to restart a test from the beginning, or skip a step entirely and continue with the next step in thetest.

The recovery scenario test options are

a. Repeat current step and continue

b. Proceed to next step

c. Proceed to next action or component

d. Proceed to next iteration

e. Restart current test run Recovery Scenario File

f. Stop the Test run

2.9 Library Function Folder:

In QTP, we can create VBScript library files containing VBScript functions, subroutines, classes, modules,

etc., and then associate the files with our test. We can call any VBScript function, subroutine contained within

Version 1.0

Document: Automation Framework Page: 14 of 27

Page 15: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 15/27

 

any library file that is associated with our test. Any test file written in standard VBScript syntax can act as a

Library file. These functions are common to many of the test scripts and are used as reusable scripts.

These common functions are stored as an attachment in Test Plan Folder of QC and each test script will call

these functions at the time of execution.

Code Description:

Common Functions:

This code contains the following:

1. Application URL

2. Excel file path in Shared location

3. Result file path in Shared Location

4. Opening of application

Function Library:

This code contains the following:

1. Functions for all web objects used in the application

2. Validations required for specific to application test cases

3. Result upload to excel

C:\Documents andSettings\subrams9\Deskt

Version 1.0

Document: Automation Framework Page: 15 of 27

Page 16: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 16/27

 

The structure is as follows: Common Code for all objects

2.10 Common Functions Execution Method:

In Keyword Driven Framework for each object in the Web based application separate code is written as a

function. For example for a text box, a separate code is written as a function. If QTP identifies the object in

Version 1.0

Document: Automation Framework Page: 16 of 27

Page 17: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 17/27

 

the Web based application as a text box then it takes the relevant code from the function library and

executes the same. At the time of execution, the script will look for the object in the Object Repository and

takes its properties from the Keyword excel. Based on the object, it selects the function from the Library

functions folder and executes the relevant object function. In the same manner all the objects in the

application for the respective scenario will be selected from the function library and executed.

Creation of Scripts – Work Flow

Prerequisite: Manual Test Cases should be ready and should have been executed once. Also the navigation

of the test cases should be clear for the automation tester to follow the flow of the functionality.

Automation Steps:

1. Execution of Manual Test Case to understand the flow of web based application and their 

functionality

2. Creating Object Repository for all identified test cases used in Web based application

3. Creating Excel file for each test case to convert the manual test cases into Keyword objects to be

recognized by QTP.

4. Add/Modify scripts if any new validations are exist.

5. Upload the test scripts and Keyword Excel in the respective folder in QC Test Plan.

6. Move the Test script from Test Plan folder to Test Lab folder for execution7. Run the script in Quality Center and report the results.

2.11 Test Script Execution:

Step 1:

QC will initiate QTP and QTP in turn invokes the Web based application.

Step 2:

a. The test script calls the functions script stored in the Library Function folder and executes the steps by

reading the keyword script data in the respective excel sheet stored in QC.

b. If any error occurs then the test script searches the recovery file stored in the Recovery Scenario folder.

If it exists then executes the Recovery Scenario scripts and resumes the execution.

Version 1.0

Document: Automation Framework Page: 17 of 27

Page 18: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 18/27

 

Relevant objects are identified through Object Repository stored in Object Repository folder.

Step 3:

During execution test script captures the important pop ups like “Account Created Successfully”, “Account

Verified successfully” and records in the Result folder. Also it updates the result in the test Lab as either 

“Pass” or “Fail”.

Version 1.0

Document: Automation Framework Page: 18 of 27

QTPWeb based

Application

Test Script

Functions

Object Repository

Recovery Scenario

Result Pass

Fail

Quality Center 

Page 19: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 19/27

 

3. Settings in QC and QTP:

The following basic settings to be done in QC and QTP for running the automation scripts.

In QC:

1. Download the Add-ins for QTP 9.5 for QC & QTP connectivity

2. Download the Java Addins for QTP 9.5

In QTP:

1. Go to File ----

Settings ----

Select Run Tab -

Select One Iteration Only option  Check the Disable Smart Identification during

The run session check box

Version 1.0

Document: Automation Framework Page: 19 of 27

Page 20: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 20/27

 

2. In Tools menu ------ Select Options -- Select Run Tab---Check the following check box options

3.1 QTP and Quality Center Integration

• Quick Test integrates with Quality Center, HP’S Interactive Web-based test management tool.Quality Center helps to maintain a project of tests that covers all aspects of Test cases functionality.

• Once the connection to Quality Center is set up, the Quick test scripts can be saved directly toQuality Center or to the local desktop.

Version 1.0

Document: Automation Framework Page: 20 of 27

Page 21: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 21/27

 

3.2 Connecting to Quality Center 

In order to connect Quick Test with Quality Center:

•To work with Quality Center, the Quality Center Connectivity Add-in that corresponds to your Quality Center version must be installed on your QTP computer.

• To establish connection with Quality Center, Choose Tools > Quality Center Connection. TheQuality Center Connection dialog box opens.

• In the Server  box, type the URL address of the Web server where Quality Center is installed(Eg:http://qualitycenter.bgrid.com/qcbin).

• In the Server connection area, click Connect.

Once the connection to the server is established, the server’s name is displayed in read-only format in theServer box.

• If you are connecting to a Automation project in Quality Center, in the Domain box, select the domainthat contains the Quality Center project

• In the Project box, select the Automation project with which you want to work.

• In the User name box, type a user name for opening the selected project

• In the Password box, type the password for the selected project

• In the Project connection area, click Connect to connect Quick Test to the selected project.

Once the connection to the selected project is established, the fields in the Project connection area aredisplayed in read-only format.

3.3 Saving test to a Quality Center Project

When QTP is connected to a Quality Center Automation project, we can create new tests in QTP and savethem directly to your project. To save a test, we give it a descriptive name and associate it with the relevantsubject in the test plan tree which helps to keep track of the tests created for each subject and to quickly viewthe progress of test planning and creation.

• Connect to Quality Center.

•In QTP, click Save to save the test in Quality Center in the popup Dialog box as follows

Note: QTP Test can be saved to Quality Center project, only when QTP is connected to a Quality Center.

• Select the relevant subject in the test plan tree

• In the Test Name box, enter a name for the test

Version 1.0

Document: Automation Framework Page: 21 of 27

Page 22: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 22/27

 

• Click OK to save the test and close the dialog box. Note that the word Uploading is displayed in thestatus bar. This word disappears when QTP completes the save test process.

Note: The next time you start Quality Center, the new test will be included in Quality Center’s test plan tree.

Opening Tests from a Quality Center project

• Connect to a Quality Center server and project.

• In QTP, click Open to open the test. The Open Test from Quality Center Project dialog box opens anddisplays the test plan tree.

Note that the Open Test from Quality Center Project dialog box opens only when QTP is connected to aQuality Center project.

• Click the relevant subject in the test plan tree.

Note that when you select a subject, the tests that belong to the subject are displayed in the right pane of theOpen Test from Quality Center project dialog box.

• Select a test in the Test Name list.

• Click OK to open the test.

3.4 Running QTP Scripts from QC

The following steps represent running the QTP scripts in Quality Center.

• In QC, Create a new “Test set” in the Test lab screen.

• In QC, click on menu Test set-> Select tests, a window with the available tests in the test plan tree isdisplayed.

• Choose the QTP test saved in QC and click on “Add tests to test set”

Version 1.0

Document: Automation Framework Page: 22 of 27

Page 23: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 23/27

 

• Click on “Run test set” or “Run” in the test lab screen to run the QTP script, the execution of <QTP>screen appears

• In the execution screen select the “run on host” option and choose the host computer to run the QTPscripts

• Click “Run all” or “Run”, the QTP script is run on the host computer specified.

QTP runs and results are displayed once the run is stopped. All the details of Test Runs are available inQuality Center  

3.5 Scheduling Test run from QC

• In QC, Create a new “Test set” in the Test lab screen.

• In QC, click on menu Test set-> Select tests, a window with the available tests in the test plan tree isdisplayed.

• Choose the QTP test saved in QC and click on “Add tests to test set”

Version 1.0

Document: Automation Framework Page: 23 of 27

Page 24: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 24/27

 

• In the Execution Flow tab, double-click a test. Alternatively, right-click a test and choose Test RunSchedule. The Run Schedule dialog box opens and displays the Execution Conditions tab.

• To add a condition, click New. The New Execution Condition dialog box opens.

In the Test box, select the test on which you want the current test to be dependent.

• Select Finished (default) to instruct the Test Lab module to execute the current test only after thespecified test has finished executing.

• Select Passed to instruct the Test Lab module to execute the current test only if the specified test hasfinished executing and has passed.

• In the Comments box, add any relevant information regarding the condition.

• Click OK. The condition is added to the list.

• Click the Time Dependency tab to specify when you want the test to be executed.

• Select Run at Specified Time, and select a Date and/or Time.

• Click OK to close the Run Schedule dialog box. In the Execution Flow, the diagram displays the testsand the conditions.

Version 1.0

Document: Automation Framework Page: 24 of 27

Page 25: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 25/27

 

4. Scripting Standards –Naming Conventions

Good coding conventions result in precise, readable, and unambiguous source code that is consistent with

other language conventions and is as intuitive as possible. The coding standard guideline is to standardizethe way coding is done across the project\organization. We are implementing the same standard for Webbased application.

4.1 Test Script Naming

• Test Script names should prefix with Transaction/Process Name and Test Case Name andFunctionality Name in mixed case with the first letter of each internal word capitalized.

• Try to keep your test script names simple and descriptive

• Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widelyused than the long form, such as URL or HTML)

• The Script Name should contain a reference to the test case or test suite

For Eg: CIF Creation, Savings_Opening_Everyday, Savings_Opening_Premier 

4.2 Function Naming

• Functions created using VBScripting should be a meaningful Name.

• They should be in mixed case with the first letter of each internal word capitalized

Ex: Public Function Finacle_LoginApplication (Parameter1, Parameter2)Statement1Statement2

End Function

4.3 Data table naming Conventions

The following standards are followed while naming the Data used script in the Web based

application.

Data table should have maximum of 25 characters

The first letters should be in Capital Letter.

Eg: Savings Data

Version 1.0

Document: Automation Framework Page: 25 of 27

Page 26: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 26/27

 

4.4 Variable Naming Conventions

The following standards are followed while naming the variables used in the script:

Variable Type Prefix Example

Array Arr ArrFileNamesBoolean Bln BlnValidated

Constants -- TRUECurrency Cur CurAmount

Date or time Dte DteBegin

Error Err ErrInvalidName

Integer Int IntCount

Long Lng LngWidth

String Str StrName

Variant Var VarNumber  

Window Win WinName

Constants --- > Capital letters (E.g. TRUE)

First letter of all the variables should be capitalized and should not have any underscores

4.5 Script Header Template

The following fields should be included in the header 

Test Tool/Version: The automation tool and its version used to script.

Test Tool Settings: This field contains the automation tool settings to execute thescript.

Function Automated: The function for which the script is created should be specified

in this field.

Test Case Automated: The Name/ID of the Test Case that is automated in this script

should be specified.

Parameterization Done: This field contains the value “Yes” if the script has values

parameterized else this field has the value “No”. If the value is “Yes” then it means the script uses Data

pools / Data Tables.

Author: The name of the script owner.

Script Name: The name of the script.

Script Created on: The date on which the script was created.

Rev.On : The date on which the script was reviewed.

Rev.No: The Revision Number 

Rev.By: The Reviewer’s name.

Version 1.0

Document: Automation Framework Page: 26 of 27

Page 27: QTP Automation Framework for Web Based Appln

5/12/2018 QTP Automation Framework for Web Based Appln - slidepdf.com

http://slidepdf.com/reader/full/qtp-automation-framework-for-web-based-appln 27/27

 

Rev.Comments: The Reviewer’s comment if any.

Mod.On: The date on which the script was modified.

Mod.By: The Modifier’s name.

Mod.Comments: Comments for the modification done.

Conclusion:

The following process can be followed for the successful automation of application for any releases:

• Scripting naming conventions should be followed

• Folder structure should be maintained in QC as prescribed

• Backup should be maintained for all the test scripts and Object Repository

• Create a separate run folder in test lab for all releases without disturbing the existing resultstructure.

• Maintain the same excel format uniformly for all releases.

• Verifying the test settings in the QTP and QC before starting the execution as prescribed inthe execution checklist.

Version 1.0

Document: Automation Framework Page: 27 of 27