automation guidelines

Upload: ksenthil77

Post on 03-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Automation Guidelines

    1/25

    TEST AUTOMATION GUIDELINES

    AND

    QTP BEST PRACTICES

  • 7/28/2019 Automation Guidelines

    2/25

    Name Org/Group Role Date

    Prepared by: Pankaj Aggrawal NBCU Automation tester 9/5/2006

    Reviewed by:

    Approved by:

    All document control issues pertaining to this document or for information about its

    access and location please contact the following resource(s):

    CONTACT INFORMATION

    Name: Pankaj Aggrawal

    Role: Automation tester

    Org/Group: NBC Universal

    Phone: *901-4047

    E-mail [email protected]

    REVISION HISTORY

    Version # Date Section/Page # Description of Changes Author

    1.0 Initial Document Archana Marwaha

    1.1 9/5/2006 1-22 QTP Pankaj Aggrawal

    Test Automation Guidelines and QTP Best Practices Page 2 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    3/25

    TEST AUTOMATION GUIDELINES AND QTP BEST PRACTICES

    Table of Contents

    .I Purpose..............................................................................................4

    .II Automation........................................................................................4What is Test Automation?................................................................................................................... 4How.. .............................................................................................................................................. 6To ensure the success of test automation success one needs to Think Past the Project and shouldexecute the project similar to the software development projects. To achieve this one needs to have............................................................................................................................................................ 6

    Plan the entire test automation effort........................................................6............................................................................................................................................................ 7Phase I Pre-Planning ................................................................................................................... 8

    Phase III - Automation Process - Key Activities ................................................................................. 8Criteria to identify good automation hat is Test Automation?..............................................................9

    .III General Guidelines...........................................................................10

    .IV Quick Test Pro .................................................................................10Purpose............................................................................................................................................. 10

    .V QTP Specific Best Practices.................................................................11

    .VI Script Organization...........................................................................13.A Coding Standards................................................................................................ 13.B Naming Conventions.................................................................................... .......18.C Implementation.................................................................................................... 20

    .VII Function Libraries............................................................................21

    .VIII Directory Structure.........................................................................23

    .IX Version Control................................................................................23.A Check In/Check Out.............................................................................................23

    .X Defect Tracking.................................................................................24.A Defect Logging & Tracking...................................................................................24.B Defect Flow Overview..........................................................................................24

    Test Automation Guidelines and QTP Best Practices Page 3 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    4/25

    .I Purpose

    The Process of building automated test script is similar to the process of software

    development. Thus, Software Engineering best practices should be implemented toensure that the code is readable and comprehensive, maintainable and reusablewhenever possible. This document provides details of these Automaton Test Scripting

    Best Practices.

    The standards and best practices outlined in this document should be adhered to for

    any test automation project.

    .II Automation

    What is Test Automation?

    Software test automation is automating the steps of manual test cases using an

    automation tool, to shorten the testing life cycle. As part of manual testingsame test cases have to be executed several times.

    This might be true when application undergoes regression. Due to human error

    some of the steps might be missed out or skipped. Automation helps to avoid suchhuman errors and also expedite the process. Implementing successful Test

    Automation in an SDLC requires a detailed planning and effort. It is required tothink Past the Project prior to initiating the task of automation and have a clear

    picture of final goal that has to be achieved. The below sections describe in detailthe approach and process to be followed to achieve an effective and optimized

    solution for successful Test Automation.

    Why..

    Automation saves time and effort which results in reduction of the Test lifecycle. Various test cases (including the data driven tests) can be executed using

    the automation tool with minimal human intervention and effort thus resulting

    in reduction of cycle time in test execution. Automation techniques can be madeto reduce / eliminate human intervention

    Benefits of test automation are given below

    Consistency of test execution and eliminating human error

    Reducing cycle time of regression test cyclesData driven testing

    Earlier defect detection.

    Faster Regression

    Repeatability

    Coverage

    Reliability

    Reusability

    Test Automation Guidelines and QTP Best Practices Page 4 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    5/25

    The graph below depicts the relationship between effort consumed inautomation vs. the time elapsed. A higher initial effort in building a test

    automation effort results in a long-term benefit.

    Complex functionality wherever possible should be automated. This leaves

    enough time for testers to focus on the other granular tasks related to testing.On other hand these scripts can be used to test the application more rigorously

    thereby reducing the chances of any defects getting deployed into production.

    When ..

    Before initiating test automation one needs to evaluate whether it is aviable/profitable solution. Automation life cycle is a subset of the entire test life

    cycle and the same can be started during the initial phases of the Softwaredevelopment life cycle. Automation planning can be initiated in parallel to the

    test planning phase. To know more about activities performed in each phasehere Factors to be considered while deciding for automation

    Application is stable

    It is essential that the Application under test (AUT) is stable enough todevelop an automated suite, else the effort that goes in for updating and

    maintenance of the scripts goes very high.

    Number of regression cycles to be performed

    In case testing is in its final phases of development or the number of

    regression cycles to be performed is relatively low, then it is not advisableto go in for test automation.

    Compatibility of Application Platform with Testing tools

    Test Automation Guidelines and QTP Best Practices Page 5 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    6/25

    Depending upon the Application platform and technology, there are varioustesting tools available in the market. Rational, Mercury Interactive, Segue

    and Compuware provide most of the popular testing tools. There are some

    applications, which cannot be recognized using the available testing tools.Thus the automation of such applications is not possible.

    Cost Benefit Analysis.Good testing tools that can be used for developing an effective test suite

    are expensive. The decision of initiating test automation also depends onthe factor if the organization is willing to make the necessary investments.

    In certain cases it might be a viable solution however due to limitation ontime or cost it might not be an acceptable solution

    Availability of Skill team

    Success of a Test automation project is a result of effective partnershipbetween the test automation team, manual testing team and the

    development team. It has been observed during the past experience thatthe manual testers have a fear of losing there jobs in case the test

    automation is used for testing. Thus the goal of automation should be veryclear with in the team as support of the manual testing team would be

    inevitable make Test Automation a success.

    How..

    To ensure the success of test automation success one needs to Think Past the Projectand should execute the project similar to the software development projects. To

    achieve this one needs to have

    Clarity of what one wants to achieve thru automation.

    Executing the project similar to a software development project Take up test automation as a fulltime effort and not as sideline

    Plan the entire test automation effort

    Develop an automation approach, based on the project requirement andCTQs of the customer

    Create test framework, which are application-independent

    Create test design & treat it as a separate entity from test framework

    Ensure the source code / scripts are properly managed & tracked

    Track defects in the automated scripts and test them before handing itover to the testing team for execution.

    Develop help files/ support document for the test suite user.

    Test Automation cycle needs extensive planning, development and implementation.

    Based on the various activities to be performed the entire test automation life cycle canbe divided in to different phases. Each phase holds its own value in the test life cycle.

    A standard Automation Process followed in any Test Automation project depicted in thediagram below

    Test Automation Guidelines and QTP Best Practices Page 6 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    7/25

    Test Automation Guidelines and QTP Best Practices Page 7 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    8/25

    Phase I Pre-Planning

    Perform the Gap Analysis to understand the existing scripts and client

    CTQs / requirements. Application walk through

    Create the Traceability Matrix Review the existing manual test scripts. Rewrite unclear/ ambiguous test steps and convert them into modular

    manual scripts. Ensure that the Application to be tested is stable enough to initiate the

    development of automated scripts. Verify the availability of the test data (Application Data) in the backend.

    Incase the data is not available in the application, prepare the validapplication

    Align manual scripts on proposed automation strategy Define expected results for each test step/ test case

    Prepare valid positive test data (script Data) for test steps whereverrequired.

    Identify the smoke test manual test scripts set Identify the regression test suite.

    Phase II - Test Automation Planning

    Create Test Automation Strategy

    Test Design Coding standard

    Naming Convention Test Automation Architecture for developing the automation framework

    Creation of Test bed Script design takes care of the concept of modularity and re-usability.

    This is depicted in the diagram below:

    Phase III - Automation Process - Key Activities

    Some of the key activities that we perform as part of test automation arelisted below:

    Develop function libraries consisting of reusable functions, using the

    automation tool, which can be saved in library files Prepare / maintain Test bed Develop the custom log file Identify the custom objects in the application and map them to a

    standard object. Create test scripts based on the test steps available in manual test

    scripts Identify and create the checkpoints and synchronization points to be

    inserted in the scripts Connect to the database (Excel/database) and parameterize the scripts

    for data driven testing Exception handling for the scripts

    Comments to ensure the readability of the scripts

    Test Automation Guidelines and QTP Best Practices Page 8 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    9/25

    Re-visit the traceability matrix to ensure the coverage between the

    Automated test scripts and the Manual test scripts

    Debug scripts and ensure the smooth running of the scripts Do a peer review of the scripts Maintain the various versions of the automated test scripts using the

    version control system. Create a test script file to call the automated test scripts in a specified

    series to be executed in a batch mode Run the test suite in batch mode as per the execution plan Prepare the User Manual document to run the automated test scripts

    Adhere to the above-mentioned steps to ensure a test suite that has thefollowing features

    Re-usability Develop a robust function library to be used across the

    projects and within the application. Robustness Develop a robust test suite that can be easily used for

    testing the application in different environments e.g. development,testing and production.

    Portability To ensure easy installation of the suite in differentenvironments.

    Modularity Develop modular scripts to ensure maintainability,scalability and readability of the scripts.

    Scalability - Scalable scripts which can be upgraded/ enhanced. Maintainability The approach should be such where in major effort

    goes in to the planning and developing the scripts where as leastpossible effort is required to maintain the same.

    Data Driven Testing To perform positive and negative tests usingdata driven scripts.

    Criteria to identify good automation hat is Test Automation?

    The following points should be considered while identifying the good candidates forautomation

    Repeatable test scripts: - Test scripts to be executed repeatedly for smokeand functional testing.

    Regression test scripts: - Test scripts that are a part of the regression test

    suite.

    Re-usable functions/tasks :-Functions/tasks that are reusable across themultiple applications and modules

    Repeatable steps:-Repeatable steps, to be performed during the manual test

    execution.

    Data driven testing :- Manual test scripts that involves the data driven testingusing positive and negative set of data

    Complex test steps:-Test scripts involving tedious and complex steps. E.g.

    Opening and verifying an application or url.

    GUI verification: - Test scripts involving GUI object properties verification.

    Test Automation Guidelines and QTP Best Practices Page 9 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    10/25

    Existence/property verification:-Test scripts that involve verification of the

    existence or properties of the object, text, page, image or database. Automation feasibility :- Test scripts which can/cannot be automated ,should

    be known prior to classifying the same as a good candidate for automation

    .III General Guidelines

    1) Automation scripts should only be written once the requirements for theapplication under testing (AUT) are finalized and the manual team has been

    engaged to write test cases and manual test scripts.

    2) Test cases should be written with automation in mind. If a test case cannot bewholly automated, then it should be split into two or more test cases, at least

    one of which can be fully automated, and at least one of which will be executed

    entirely manually.If the Manual team delivers a test case that cannot be fully automated to the

    Automation team, the Automation team should request that the manual teamsplit the test case.

    This is done to simplify coverage reporting it can always be assumed that an

    automated test covers the full scope of the corresponding test case withoutexceptions.

    3) Automation scripts should be created on a test case-by-test case basis.

    Automations should be created only where positive ROI is anticipated, based onthe requirements defined in the test case.

    4) Use Common Libraries for activities like Reporting, Database Access etc.

    5) Use Exit conditions and Exception Handling wherever applicable.

    .IV Quick Test Pro

    Purpose

    Mercurys Quick Test Pro will be used for Test automation by the SDRUP QA team. Thisdocument lays down the Standards, Naming Conventions and Best Practices to be used

    preparing automated test scripts using Quick Test Pro.

    Audience

    This document is for any automation engineer following the SDRUP QA process andusing Mercurys Quick Test Pro. This is also for any member of the project or

    development teams interested in understanding how testing team develops theautomated scripts using QTP.

    Summary

    Test Automation Guidelines and QTP Best Practices Page 10 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    11/25

    Quick Test Pro is a Test Automation Tool that helps teams to automate the test cases,and execute automated test run.

    Mercury Quick Test Professional provides the industrys best solution for functional test

    and regression test automation - addressing every major software application andenvironment. Quick Test Professional satisfies the needs of both technical and non-

    technical users. It enables you to deploy higher-quality applications faster, cheaper,and with less risk.Quick Test Professional provides an interactive, visual environment for test

    development.Mercury Quick Test Professional allows even novice testers to be productive in

    minutes. User can create a test script by simply pressing a Record button and using anapplication to perform a typical business process. Each step in the business process is

    automated documented with a plain-English sentence and screen shot.

    .V QTP Specific Best Practices

    The below section specifies the QT Pro specific best practices to be used by the testingteam for developing test scripts.

    Function libraries - Develop the reusable functions using the compile modules.

    1. Custom Log File

    Under certain erroneous conditions QT Pro aborts abnormally, closing the test resultfile created. Under such circumstances the results of the test run are also lost. To

    handle this, a custom log file will be created to log the test results of the

    automation test run.

    2. Name of the Custom Log FileThe name of the log file created will include the name of the test run and the date

    of the execution of the test. Thus the unique custom log file will be created for eachtest run.

    3. Checkpoints

    A Checkpoint is typically created at a point in the script where the state of an objectcan be confirmed across builds. QT Pro supports several different types of

    checkpoints. The checkpoint captures object information and stores in an expectedfolder. During playback, the object information is recaptured and stored in the

    result folder and compared with the baseline to validate whether the checkpointpasses or fails. QT Pro supports a range of checkpoints of which the following were

    deemed suitable for the automated testing exercise:

    Standard Checkpoint: This captures and compares the properties ofstandard objects, window in the application. This can support thevalidation of windows and objects used in the application. It also

    provides specialized support for environment-specific objects such asJava objects, Visual Basic Data controls, ActiveX controls, HTML and

    Power Builder data windows, and Oracle Forms base-table blocks.

    Text area check point

    Text checkpoint This check point can be used to read texts and verify

    the contents on gui objects and bitmaps.

    Test Automation Guidelines and QTP Best Practices Page 11 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    12/25

  • 7/28/2019 Automation Guidelines

    13/25

    13. Create a test script file to call all the test scripts in a specified series in the batch

    mode.

    14. Run the Test suite in a batch mode.

    15. Maintain the various versions of the test scripts using the version control system.

    16. New Environment Support: Supports Web services, .NET 2.0, Fire fox 1.5,Netscape 8, Macromedia Flex 2, Win XP 64 bit, Internet Explorer 7, and the latest

    ERP/CRM applications

    17. Open XML Report Format for Test Results: Stores test results in an open XMLformat, enabling you to easily customize the reports according to your own

    requirements, and to integrate the test result information with otherapplications. Test results can now be exported to HTML

    .VI Script Organization

    This section specifies the various standards to be followed by the SDRUP QA team while

    developing, maintaining and organization of the QT Pro scripts

    .A Coding Standards

    This section specifies the various standards to be followed by the SDRUP QA team while

    developing and maintaining the QT Pro scripts.

    Goals of these standards -

    This section explains the goal of having the coding standards to be used in the

    development of test scripts. Following are two basic, but very important goals:

    The use of these guidelines and standards should result in readable code

    and should encourage adherence.

    The resulting documentation should be easy to maintain.

    Before having the QT Pro code, one should have a process for writing the code.Thus this section will help the Automation Team to use these standards while

    developing the code and maintaining the QT Pro scripts.Some amount of standardization is especially important in large development

    organization such NBC Universal, for writing the programs or scripts. The codewill be shared amongst the development and UAT team and will also be used

    and maintained by the SDRUP QA team. Thus it must be clear what the codedoes, how it should be used, how it can be extended, etc. The standards within

    this section have been written to balance the group need for standardizationwith the individual's desires to code in the ways they feel most efficient.

    Test Automation Guidelines and QTP Best Practices Page 13 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    14/25

    Scope and application of the standards.

    This section is divided into two areas -- Rules and Guidelines.

    Rules are those coding standards that are "necessary and required" codingpractices that have to be followed by the Test Automation engineer. Everyone is

    expected to follow these "rules".

    Guidelines are "suggested" coding practices that have been written to

    recognize the need for individuality and for common coding practices. Thepurpose of the guidelines is to provide a framework upon which we can all

    create better code. However, the guidelines are not meant to impedeengineering efforts when these guidelines are found to be in direct conflict with

    an individual's preference, so long as that preference is implementedconsistently and is well documented. Finally, because it has been recognize that

    this opens the code upon to individual stylist coding habits, it is important thatthese habits are well documented and will then become the basis for all other

    updates within the affected files.

    Documenting code

    The documentation section is a block of comments for a particular test script, and

    describes the objectives, flow and dependencies of the script.The documentation section is required for every script and file. Lack of a

    documentation block will be severely detrimental to readability and maintainability ofthe script.

    The code in the test script should be well commented. The test engineer should

    include the following in the test script.

    Any updates made in the script should be documented in the form of the comments.The part of code, which has been changed or added to the script, should be

    commented so that the author or other test engineers can easily locate any change inthe script. Date of change, any cross-reference to the Change Control Form /

    requisition number and the description of the change and the reason for change has tobe included in comments.

    Purpose of using a function, checkpoint, and external file should be specified using

    the comments.

    On the beginning on every Test script the associated Test script in the Quality Centershould be mentioned.

    Layout of QTP Script Files

    The layout for a class will be broken up into the following main sections:

    Test Automation Guidelines and QTP Best Practices Page 14 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    15/25

    Action Header

    The Header in each Script File will contain the following information

    /*=======================================================

    = */

    *Action Name - Name of the Action. The action name will specify the module name*

    * and type of test action

    * *Action Type Specify the type of action e.g. Functional*

    *Module Tested Name of the module to be tested*

    *Object Repository Name of the Object Repository

    *

    *Libraries Used Name of Library files (if used)*

    *Called From Name of the calling action**Created by Name of the test engineer

    *

    *Date Date of creation of the Test Action*

    *Updated- Name of the test engineer who updated the script with date*

    *======================================================

    == *

    Action Code

    Test Action #

    Corresponding VB script Code

    Guidelines

    Line SpacesLine width should not ordinarily exceed 80 characters. Use your best judgment.

    IF / Else Statement

    Place the IF keyword and conditional expression on the same line.

    E.g.if (expression)

    {statement ;

    Test Automation Guidelines and QTP Best Practices Page 15 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    16/25

    }else

    {

    statement;}

    orif(expression) {

    statement ;

    } else {statement;

    }While

    The WHILE construct uses the same layout format as the IF construct.

    The WHILE keyword should appear on its own line, immediately followedby the conditional expression. The statement block is placed on the next

    line. The curly braces may optionally be indented by up to 1 tab space.

    Exampleswhile (expression)

    {statement;

    }or

    while(expression) {statement;

    }Do..While

    The DO..WHILE form of the while construct should appear as

    shown below:

    Examples

    do{

    statement;} while (expression);

    or

    do {

    statement;

    } while (expression);Switch

    The SWITCH construct uses the same layout format as the if construct.

    The SWITCH keyword should appear on its own line, immediatelyfollowed by its test expression. The statement block is placed on the next

    line. The curly braces may optionally be indented by up to 1 tab space.

    examples:

    Test Automation Guidelines and QTP Best Practices Page 16 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    17/25

    switch (expression){

    case n:

    statement;break;

    case x:statement;// Continue to default case

    default:statement;

    break;}

    or

    switch (expression) {case n:

    statement;break;

    case x:statement;

    // Continue to default casedefault:

    statement;break;

    }

    Test Script Template

    The test script template will specify the template to be used by the

    testing team for writing the test scripts. Below is the list of various typesof files to be created in the development of the test suite and thetemplate to be used for each type of file.

    Startup file

    Single startup file to load the application

    Load function libraries

    Make the mappings of the custom objects to standard objectspermanent.

    Shell Script File

    Open connection to the test data set (ODBC /Excel)

    Call script files

    Close connection to the test data set

    Object Repository File:- A file with the extension *.tsr. This file containsthe information about the objects used in the test.

    Script file

    Separate action for each module

    Separate action file will be created, depending upon the type of testing

    performed (e.g. functionality, database)Test Automation Guidelines and QTP Best Practices Page 17 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    18/25

    Script header is to be included in all the action files.

    Manual test case name, for which a code is being written, is to be

    mentioned.

    Comments to be included.

    Purpose of using a function in the script, is to be specified in the

    comments. Preferably small action files with modular approach.

    .B Naming Conventions

    Following are the naming conventions and standards to be followed by the automationteam in the interest of script readability and maintainability.

    Variables (Based on Scope)

    Scope Prefix Followed by

    Global g_ Variable type prefix

    Notes: Local Variables do not require a scope prefix.

    Variables (Based on Variable type)

    Variable Type Prefix Followed by

    String s Variable name beginning with upper case for each

    segment of the name

    Integer i Variable name beginning with upper case for eachsegment of the name

    Boolean b Variable name beginning with upper case for eachsegment of the name

    Float f Variable name beginning with upper case for eachsegment of the name

    Variant v Variable name beginning with upper case for each

    segment of the name

    Constants

    All constants should be Upper case.

    Example:

    1. For variable Sales Invoice which is a string and global the naming should beg_sSalesInvoice

    2. For variable Invoice Number which is an integer and local the naming should beiInvoiceNumber

    3. For constant File Type the naming should be FILETYPEFunctions

    Test Automation Guidelines and QTP Best Practices Page 18 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    19/25

    Functions should be created for repeating steps or activities. Identify FunctionCandidates before creating Scripts.

    Function Type Prefix Followed by

    GUI related bsr Object name beginning with upper case for each segment

    of the name

    Checkpoint related pge Object name beginning with upper case for each segment

    of the name

    Generic win Object name beginning with upper case for each segment

    of the name

    Database Access txt Object name beginning with upper case for each segmentof the name

    The function should be named in the following pattern.

    __

    Example:

    To name a function for Login in Sales Management module, the naming should be

    gen_SM_Login

    .1 Function Documentation

    For VBS functions, the documentation block should be written as follows.

    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ' Description: Login to Mercury Tours'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ~~~' Parameters:

    ' sURL - URL' sUserName - User Name

    ' sPassword Password Return Value: Status of Login (PASS/FAIL)

    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    .2 Function Parameters

    The function Parameters should follow the same naming convention specified

    above.

    .3 Return Values

    If a function doesnt return any value create a Sub Procedure instead of a Function.

    Test Automation Guidelines and QTP Best Practices Page 19 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    20/25

    Objects

    Variable Type Prefix Followed by

    Browser bsr Object name beginning with upper case for each segmentof the name

    Page pge Object name beginning with upper case for each segment

    of the name

    Window win Object name beginning with upper case for each segmentof the name

    Text Box txt Object name beginning with upper case for each segmentof the name

    Label lbl Object name beginning with upper case for each segmentof the name

    Combo Box cbo Object name beginning with upper case for each segment

    of the name

    Check Box chk Object name beginning with upper case for each segmentof the name

    Radio Button rad Object name beginning with upper case for each segment

    of the name

    Button btn Object name beginning with upper case for each segmentof the name

    Image img Object name beginning with upper case for each segmentof the name

    Link lnk Object name beginning with upper case for each segmentof the name

    Frame frm Object name beginning with upper case for each segment

    of the name

    Dialog dlg Object name beginning with upper case for each segmentof the name

    Example: For Userid Text Box, the naming should be txtUserID.

    .CImplementation

    .1 Implementation section structure

    Scripts should generally be divided into three blocks to ensure readability and

    maintainability:

    .a Initialization blockAll resources/environment variables should be loaded in this block

    Test Automation Guidelines and QTP Best Practices Page 20 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    21/25

    Example:

    ' Create Objects

    ExecuteFile "..\..\Keyword\Common\Objects\lib_Object.vbs"

    rc = gen_CreateObjects("..\..\Mercury\Common\Data\dt_Object.xls")

    .b Execution block

    Example:

    Login to Mercury Tours and Find a Flightrc = gen_Mercury_Login(mercury,mercury)

    rc = gen_Mercury_FindFlight(roundtrip,New York,Paris,Business)

    .c Cleanup block

    This block should close open files and unload resources and cleanup Browsersetc.

    Example:

    Close the Browser

    rc = Browser_Close(bsrWelcome)

    .2 Pathnames

    Always use relative path instead of absolute path.

    Example:

    Instead of using c:\qtp\mercury\common\dt_Obj.xls use a path with reference tothe script like ..\..\common\dt_Obj.xls

    .VII Function Libraries

    The Functions libraries should be divided into two types. Common and Module specific.Following naming convention should be used for Library Files

    Common Libraries:

    lib_

    Example:

    For Database related function library name it as lib_Database

    For Reporting related function library name it as lib_Report

    Module Specific Libraries:lib__

    Example:

    Test Automation Guidelines and QTP Best Practices Page 21 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    22/25

    For Generic Function Library related to Sales Management Module name it aslib_SM_Gen

    For Checkpoint Function Library related to Sales Management Module name it as

    lib_SM_Chk

    Test Automation Guidelines and QTP Best Practices Page 22 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    23/25

    .VIII Directory Structure

    Test Automation should follow a Directory Structure within Quality Center for common

    files used across modules.

    Example:

    Automation Automation Folder

    QTP Tool used

    Common Common filesObjects Object Repository

    Obj1.tsrObj2.tsr

    Data Data related to the Testsdt_SM

    dt_AM

    dt_CSLibraries vbs Library Files

    lib_Report

    lib_SM_Genlib_SM_Chk

    See section IX: Version Control for a discussion of the directory structure to be used

    while scripts are under development and stored in ClearCase.

    .IX Version Control

    Rational ClearCase will be used for Version Control of Automation Scripts during

    development. Validated Scripts will be uploaded to Quality Center.

    The ClearCase directory structure should be created to conform with the directory

    structure created by the manual testing team for the corresponding project in QualityCenter. This will ensure that the automation scripts may be developed and stored in

    ClearCase and then easily migrated to Quality Center when completed.

    .A Check In/Check Out

    When Checking In/Checking Out automation scripts, the ClearCase activity name must

    be properly set. The activity name will be used for tracking scripts based on version of

    the AUT.

    Example :

    If automation team develops following 3 scripts for version 1.0 of AUT then they will be

    checked in with Activity Name as AUT 1.0.

    AUT 1.0 ---- ScriptA (1.0)

    ScriptB (1.0)

    Test Automation Guidelines and QTP Best Practices Page 23 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    24/25

    ScriptC (1.0)

    If the AUT version changes to 2.0, and ScriptA needs to be modified without anychanges in ScriptB and ScriptC, Check Out all the scripts using Activity name AUT

    1.0. Modify ScriptA and Check In all the Scripts using another Activity name reflectingthe updated version of the AUT, i.e. AUT 2.0.

    AUT 2.0 ---- ScriptA (1.1)

    ScriptB (1.0)ScriptC (1.0)

    .X Defect Tracking

    .A Defect Logging & Tracking

    All the defects will be tracked in ClearQuest.

    There will be a dedicated ClearQuest project for each automation effort. For example,

    there is a ClearQuest project called "FATS" and another ClearQuest project called"FATS Automation." Automation defects should be tracked in the FATS Automation

    project, not in the regular "FATS" project, and vice-versa.

    When applying bug fixes to an automation that has been copied to Quality Center,

    these bug fixes should be applied to the scripts in ClearCase and re-tested before beingcopied to Quality Center. Automation scripts should be copied to Quality Center only

    when they are believed to be bug-free and ready for execution.

    .B Defect Flow Overview

    Below is the defect state flow currently used in Clear Quest:

    Test Automation Guidelines and QTP Best Practices Page 24 of 25 6/7/2013

  • 7/28/2019 Automation Guidelines

    25/25

    Test Automation Guidelines and QTP Best Practices Page 25 of 25 6/7/2013

    Opened Analysis Design

    Withdrawn

    On Hold

    Development TestClosed

    Failed

    Submit Analyze ScheduleDesign

    CompletedMove to

    Test TestPassed

    Opened

    ReopenReturn to

    DevTest

    FailedMove toTest

    Return toDesign

    Close

    Return toAnalysis

    Opened

    Reopen

    HoldAnalysis

    HoldDesign

    HoldDevelopment

    Withdraw

    Reopen

    Development

    DevCompleted

    Close

    Passed