Responsible Parties
Process Owner Title/Role/Functional Organization
Contributors
Title/Role/Functional Organization
Stakeholder
Name Title/Role/Functional Organization
Automated Test Suite Setup and Execution Guide.doc Proprietary and Confidential OfficeMax
Page 1 of 14
Business Framework
Contents
Purpose ......................................................................................................................................................... 3 Definitions ..................................................................................................................................................... 3 Automated Testing Framework Overview..................................................................................................... 4 Test Suite Directory Structure....................................................................................................................... 6 QTP Configurations....................................................................................................................................... 7 Automated Test Suite Standards .................................................................................................................. 9 Coding Style Best Practices ................................................................................................................... 9 Documentation & Standards ................................................................................................................... 11 Revision History .......................................................................................................................................... 14
Page 2 of 14
Business Framework
Purpose
This guide provides instructions for installing, preparing for and executing the automated regression test for Policy Center.
Definitions
Term Automated Test Framework (ATF) Definition All test automation entities required to execute automated test cases including all QTP entities (scripts, functions, object repository, etc.) and associated data input files. Application Under Test the application being tested during an execution of the automated test suite. The AUT state that each test case expects to find the when it begins to execute. The state that each automated test case will leave the AUT in when execution is complete. Any QTP script, action or function that executes test cases / business processes. A single set of instructions (steps and data) that execute actions and verifications necessary for performing a single test case. A set of Automated Test Cases grouped together for a single Test Run. A single execution of the automated test suite. A series of test scenarios run sequentially as part of a test cycle. Any event encountered by a Test Entity that, if not detected and addressed, would cause execution to be stopped. A QTP test entity that executes a specific business process (or part of a business process) of the application under test. A QTP test entity that executes a specific verification action on the AUT required by test cases. A QTP test entity that executes a specific low-level action typically a single user action on a user interface object.
AUT Initial State End State Test Entity Automated Test Case (Test Case)
Automated Test Scenario (Test Scenario) Test Run Test Set Unexpected Event
Page 3 of 14
Business Framework
Environment File
Driver
Test Results
Business Process / Key Word / Verification Functions Application Specific | General Web
Utility Functions
Object Repository
Figure 1. Automated Testing Framework ATF Component Driver Test Case Interpreter Description A QTP script that reads Driver Data Files to determine the set of Automated Test Case Files included in the test scenario to be executed. A QTP action that reads the instructions contained the Automated Test Case Files and calls the appropriate Business Process, Keyword or Verification functions.
Page 4 of 14
Business Framework
Description Business Process Function: A QTP function that performs a series of steps specific to an applications business process (e.g. Login). Keyword Function: A QTP function that performs a generic step for a particular application type (e.g. click_link). Verification Function: A QTP function that performs validation (e.g. compare values). Functions are divided into three groups: 1. Application Specific - functions that perform business processes, keyword actions and verifications that are specific to the AUT. They generally are not reusable across automated test suites 2. General Web functions that perform keyword actions and verifications that are general to most browser-based applications. 3. General Terminal Emulator (TE) functions that perform keyword actions and verifications that are general to most TE-based (i.e. green screen) applications.
QTP functions that perform general framework operations such as error handling, results reporting, data handling, etc. A QTP entity that maps GUI object local names to their physical descriptions to enable object identification during execution. Files that contain the set of Automated Test Case Files that are executed as part of a test scenario. In addition to the path and name of the Automated Test Case Files the Driver Data Files contain the Environment File that is associated with each Automated Test Case File. A worksheet within an Excel workbook containing the instructions for executing an automated test case. An XML file containing the environment settings required by a specific Automated Test Case File.
Page 5 of 14
Business Framework
Description This directory contains all execution results. The data directory contains all necessary data files for the Driver and PolicyCenterAction scripts to execute the business process tests. This folder contains the documentation files for the ATF. This folder contains the xml files for each environment that will be tested. The XML files contain all static environment variables required by the ATF. This folder contains the library files that house the reusable functions and subroutines. The Obj Repository directory houses the shared object repositories used by all automated tests. Currently, the architecture contains two (2) repository files, SP2.tsr and TERep.tsr. SP2.tst contains object definitions for accessing the Policy Center application, and TERep.tsr contains the object definitions for accessing the terminal emulator for the WC Pledge application. This directory contains error handlers to supplement the Driver and PolicyCenterAction scripts in an event of an unexpected occurrence during a test run (e.g. a pop-up dialog box or a Page not found error). Currently, there are no recovery scenarios that have been defined for this implementation. The ScreenMap folder contains the database that stores the mapping locations of the terminal emulator (TE) screen fields.
Automated Test Suite Architecture Guide.doc Proprietary and Confidential OfficeMax Page 6 of 14
Documents Environment
RecoveryScenarios
ScreenMap
Business Framework
Directory Scripts
Description The Scripts folder contains the QTP scripts necessary for the automation: Driver and PolicyCenterAction.
QTP Configurations
The following table describes the required QTP configurations: Area Folders Description QTP can set the root directory path for the test suite. This setting must be set in the Driver file under Tools>Options>Folders. An example of the path that would be set is C:\Work\SP2. The directory structure listed inside of this directory would be the folder structure pictured in Section 2. When the test suite is moved to another computer or another directory, it is necessary to confirm that the binding to external actions that occurs within the Driver script still exists. To do this, open the Driver script in QTP. The following datatables should exist as tabs across the bottom: Global, Driver, and PolicyCenterAction [PolicyCenterAction]. If either of the last two tables does not exist, go to the very top line in the script. From the toolbar select Insert>Call to Existing Action. In the From test drop-down, select either PolicyCenterAction from the directory where it resides. If it is not found in the drop-down, browse for the script. Change the path to a relative directory (e.g. ..\..\Scripts\PolicyCenter\Action1). Press the OK button and when you return to the script there should be a new line of code that starts with the statement RunAction. IMPORTANT: Delete this line of code and save the Driver script.
Page 7 of 14
Business Framework
Area Resources
Description Shared Object Repositories The path to the shared object repository must be correct in both QTP scripts (Driver and PolicyCenterAction). First open PolicyCenterAction to verify that the shared object repository is found. If it cannot be found a message should pop-up upon opening the test and you can browse to the new location of the repository. Then open the Driver script to do the same. There is another place to specify where the shared object repository is located as well. In Resources>Associate Repositories there is a section called Repositories. The directory to the repository should be specified as ..\..\Obj Repository\SP2.tsr and ..\..\Obj\Repository\TERep.tsr. Function Libraries In Test>Settings>Resources there is a section called Associated library files. There should be three entries in this location for the libraries. This includes: ..\..\Lib\Web_lib.txt ..\..\Lib\PolicyCenter_lib.txt ..\..\TE_lib.txt
The PolicyCenter application is built using a third party package from Guidewire. Since Guidware code is automatically generated, some of the objects can be difficult to identify. One particular challenge is working with tables, which are used extensively in the PolicyCenter application. There are a set of AFT functions specifically developed to work with tables. Column name is used as the primary means to identify tables. The column name is passed as a parameter and the functions search for that label to locate the table. If more than one table with the same label is present, an instance parameter is required to determine which instance of the object to use. Please refer to the Quick Reference Guide for detailed explanations of the table functions. Most of the Guideware objects have an additional attribute called SmokeId. In some instances, the SmokeId can be used to identify the object. The SelectTopNav function takes advantage of the SmokeId to select the correct top navigation button.
Page 8 of 14
Business Framework
Page 9 of 14
Business Framework
Coding Complexity
Page 10 of 14
Business Framework
Description Constant declarations must include a comment header All public and module-level constant declarations must include a standard comment header describing what the constant value represents and how it is to be used. Comments within procedure code blocks Code statements within procedures should be interspersed with comments to describe the logical operations being performed by the statement blocks. Comments should not merely echo the physical code. Procedure comment header All procedures must include a standard comment header describing what the procedure does as well as details of any arguments used and return values. Format of procedure header comments Procedure header comments must take the following form: opening comment separator line, procedure name, created by, date created, one or more lines describing the procedure followed by individual argument names and descriptions, one or more lines of describing return values (including any errors raised by the procedure) and ending with a closing comment separator line. Use reminder comments Whenever an issue within source code is identified which cannot immediately be resolved, a reminder comment may be inserted into the source to ensure the issue is not forgotten. Comments beginning 'TODO: will be treated as reminder comments and should describe the issue appropriately including the name of the developer responsible for the comment and the date the issue was identified. User-defined type definitions must include a comment header All user-defined type definitions must include a standard comment header describing what the type represents and how it is to be used. Variable declarations comments All public and module-level variable declarations must include a standard comment header describing what the variable represents and how it is to be used.
Naming Conventions
Area Application Object Names
Last Revised: 11/01/08
Description Object names should capitalize the first letter and follow the CamelCase convention. (e.g. objBrowser)
Automated Test Suite Architecture Guide.doc Proprietary and Confidential OfficeMax Page 11 of 14
Business Framework
Description When naming a variable, capitalize the first letter and follow the CamelCase convention. (e.g. strFirstName) All letter of a constants shall all be CAPITALIZED. When naming a function, capitalize the first letter and follow the CamelCase convention. All functions shall have proper function headers.
Page 12 of 14
Business Framework
Description The functions shall be written using VBScript. The function header should contain: Name Parameters Specify the parameters used by the reusable action. Indicate any optional parameters o IN Describe any input parameters o OUT Describe any output parameters o RETURN Describe any return parameter Description Created By Create Date
Sample '************************************************************************ 'Name : 'Parameters: ' Returns: Desc: 'Created by: 'Created on: IN IN WriteExcelReport(ScriptName, TestResults, Remarks) Script Name - This is the name of the Script that is calling this function TestResults - This takes "Fail" as the results parameter for only the failed Transactions. Remarks - This takes the Remarks Field of the Failed Transactions as to why the Transaction failed. N/A Writes the Failed Transactions Test Results into an Excel Report. Utopia Solutions 11/15/2007
IN
'*************************************************************************
Page 13 of 14
Business Framework
Revision History
Content Revision History - PAL ID:
This log stays with the completed document to track published revisions to the content. Version Date Revision Description Revision Author
Page 14 of 14