Test Automation Framework User Manual
Test Automation Framework User Manual
Page 1 of 22
EDS and the EDS logo are registered trademarks of Electronic Data Systems Corpo ration.
EDS is an equal opportunity employer and values the diversity of its people. Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Project Name: Amendment History - Document Status (e.g. Draft, Final, Release #):
CR# (optional)
Document Version#
0.1 0.2
Approval Date
NA 10-May-08
Modified By
Nadeem Nadeem
0.3
01-Oct-08
Nadeem
a) b) c) d)
0.4
05-Nov-08
Nadeem
a)
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 2 of 22
Glossary of Acronyms
Acronym GUI QTP QC Full Length Graphical user Interface QuickTest Professional Quality Center
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 3 of 22
Table of Contents
USE F9 TO UPDATE THE TOC
1 Objective.......................................................................................................................................5 2 High level design features.............................................................................................................6 3 Supported Environment................................................................................................................6 4 Supported Modes of Automated Script execution........................................................................6 5 Architecture ..................................................................................................................................7 6 Procedure for Installing the Framework.......................................................................................7 7 Folder Structure and Components................................................................................................8 8 Procedure for Developing Shared Test Object Repository.........................................................14 9 Procedure for Developing Test Data Tables...............................................................................15 10 Library of Utility Functions......................................................................................................15 11 Procedure for Developing Automated Test Scripts..................................................................18 12 Procedure for Configuring Test Environment..........................................................................19 13 Procedure for Executing Automated Test Scripts.....................................................................20 14 Known Limitations...................................................................................................................22 15 Acknowledgement....................................................................................................................22
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 4 of 22
1 OBJECTIVE
Functional Test Automation, much as it is essential for achieving higher Test coverage and improved Test execution productivity on any project has its own challenges that are derived from but not limited to the following
The type of application (Web based or non Web-based) The technology used to develop the application (Java, .NET etc) The platform used to host the application (Windows, Unix etc) The complexity of the business functionality and its User interface design
In a scenario where the inputs/requirements for any Test Automation project are varied, the need of the hour is to develop a Test Automation Framework that can accommodate these varying inputs/requirements and additionally provide the following benefits
A consistent architecture for the automated solution A consistent approach to develop the automated solution specific to each Test Automation project. Improved Test script development productivity Reusable Utility functions that can be consistently used across all technologies supported by the Tool
In EDS, the preferred Test Automation tools are the HP-Mercury tools namely QuickTest Professional (QTP) and Quality Center (QC). QTP is the primary tool of choice for implementing Test Automation on all projects in future, unless the client has a specific preference to use tools from other vendors. With this in focus, the Test Automation sub-capability has worked on developing a Generic Test Automation framework using QuickTest Professional tool. The objective of this document is to provide the details of the different components of the Generic Test Automation Framework that is a core part of the Organizational strategy in establishing consistency in the way the Functional Test Automation projects would be executed across GTP. To enable end users to understand and use the framework, this document details the way the Framework supports the development, maintenance and execution of the automated test scripts. In addition to this, the document also provides the necessary details related to configuration of the framework as well as the way to create and use external data sources for enabling creation of automated test scripts using the Data driven or Keyword driven approaches.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 5 of 22
3 SUPPORTED ENVIRONMENT
Test Management Tool : Quality Center Test Automation Tool : QTP version 9.2 or higher Supported Operating Systems: All QTP supported operating systems Supported Browsers: All QTP supported browsers
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 6 of 22
5 ARCHITECTURE
Data driven framework
E:\2.CAPABILITY\ DOCUMENTS\2008\Test Autom ationFram ework\Fram ework-UserManual\Architecture - Data driven fram ework.doc
E:\2.CAPABILITY\ DOCUMENTS\2008\Test Autom ationFram ework\Fram ework-UserManual\Architecture - Keyword driven fram ework.doc
Please note that the framework supports developing and executing the test scripts either via Quality Center or on a local system when Quality Center is not used. In a scenario where Quality center is used, we need to complete the installation of the framework artifacts on a local system (as explained above in the inserted document) and then complete the following tasks. Create the project-specific folder on Quality Center in the Test Plan module . Under the project-specific folder on Quality Center: Replicate the folder structure as available on the local system after installation Transfer the framework files from the local system to the corresponding folders on the Quality Center project.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 7 of 22
MS Word Portrait Template Updating the Test_Settings.xml file In the Test_Settings.xml file available in Test_Configuration folder in Quality Center, update the value tag of the tag PROJECT_FOLDER_PATH with the absolute path of the folder under which the framework artifacts are installed on the local system.
For Ex: If the framework is installed in the D: drive in the folder named Generic_Framework, then the value of the PROJECT_FOLDER_PATH should be as follows. ****************************************************************************************************************** <Name>PROJECT_FOLDER_PATH</Name> <Value>D:\Generic Framework</Value> Note: In a non Quality Center environment also, the PROJECT_FOLDER_PATH variable in the Test_Settings.xml file available in the Test_Configuration folder on the local system needs to be updated in the same way as explained for the Quality center environment. If the testing of Web applications is carried out on multiple browsers, update the BROWSER_TYPE tag with the values corresponding to different browsers as shown below. a) When testing has to be done on Internet Explorer browser, the value should be InternetExplorer b) When testing has to be done on Mozilla Firefox browser, the value should be MozillaFirefox c) When testing has to be done on Netscape browser, the value should be Netscape
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
***********************************************************************************************************
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 9 of 22
MS Word Portrait Template Details of each folder [Project_Name]: This is the main folder under which all the artifacts used for the Test Automation project are stored. To uniquely distinguish the artifacts across different projects, it is suggested that the main folder is given the name that has a reference to the project name/ID. Test_Configuration In this sub folder, the file named Test_Settings.xml, that stores the Test environment variables and their corresponding values is stored by default. New variables can be added as required in this file. In a non Quality center environment, the Test_Execution_Configuration.xls file (created using its template) that provides inputs to the Test driver script on the modules and the corresponding automated scripts that need to be executed is also stored in this folder. When the keyword driven approach is used, the KeywordDriven_FunctionReferences.xls file that contains a mapping of the Keyword driven functions and the library files in which they are stored will also be updated and stored in this folder. Test_Data In this sub folder, the external Test data source files are stored. The test data files should be created by using the template Test_Data_Source_Template.xls that is stored in the Test_Templates folder. Multiple data files and each file containing multiple test data tables can be created and stored in logically related sub-folders in this folder. Refer the section Procedure for creating Test Data Tables for more details. Note: A sample data file is also shown in this folder Test_Drivers In this sub folder, the Test driver script named DriverScript.vbs that is used to execute automated scripts developed using data driven approach or keyword driven approaches is stored. Note: The test driver is used for executing selected automated scripts only when Quality Center is not used on the project. If Quality center is available, Test sets containing the required test scripts will be created in the Test Lab module in Quality center and used for executing the required test scripts. Test_Libraries In this sub folder, the following files are available. a) Framework_Utility_Functions.vbs. This file contains reusable Utility functions that act as building blocks for developing the automated test scripts. The user has the option of adding more Utility functions to the existing Library. The user is also recommended to create a Library of Business functions and store the file in this folder. Refer the section Library of utility Functions for more details on the existing functions in the library file. Note: Sample business function libraries created for use in data driven and keyword driven scripts have also been included in this folder.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 10 of 22
MS Word Portrait Template Test_Object_Repositories In this sub folder, one or more Shared Object repositories, that contain the Test Object Properties of all Test objects that are referenced in automated scripts, are stored. Note that the shared repositories are created using the standard process as defined in QTP. Refer the section Procedure for Developing Shared Test Object repository for more details. Test_Result_Log In the scenario where Quality Center is not used for execution of automated test scripts, the QTP generated result file that contains the details of all execution steps for the selected automated scripts will be stored in this folder with the name corresponding to the date-timestamp when the execution was initiated. Refer the section Procedure for Executing Automated Test Scripts for more details. Test_Scripts In the Data driven approach, Test Scripts are created using the QTP based Test script template named DataDrivenScript_Template that is available in the Test_Templates folder. In the Keyword driven approach, test scripts are created using the excel based template named KeywordDriven_ActionFile_Template.xls. It is mandatory to store the logically related test scripts belonging to a module in the application under corresponding sub-folders and store the corresponding automated test scripts in these subfolder. For Ex: If the application has modules named Admin, Reports etc and for each of these modules there are multiple test cases that are to be automated, then in the Test_Scripts folder create sub-folders named Admin and Module (or any name as per conventions defined in the project) and store the correspondingly related automated scripts in the Admin and Reports sub-folders. Note: Sample scripts created using Data driven and Keyword driven templates are also shown in this folder. Test_Templates In this sub-folder, the following templates are provided. a) Test_Data_Source_Template.xls: This template is used for creating the required test data tables for either the keyword driven or data driven test scripts. Please refer the Instructions worksheet for more details. Also note that we can create multiple test data files and each file can have multiple test data tables. It is recommended to store the project specific data files in logically named sub-folders in the Test_Data folder (similar to the recommended way for storing automated scripts in the Test_Scripts folder).
Test_Data_Source_T em plate
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 11 of 22
b) Test_Execution_Configuration_Template.xls: This template is to be used only when there is a requirement of executing the automated test scripts on a local system without using Quality center. The entries in this file are used as inputs for the Test driver to enable the execution of selected scripts of the corresponding modules of the application being tested. The template should be renamed to Test_Execution_Configuration.xls and placed in the Test_Configuration folder. Refer to the Instructions worksheet in the template for more details on conventions to follow in making specific entries in the Module_Selection worksheet as well as creating additional worksheets that contain a listing of the automated test scripts available in each module.
c) DataDrivenScript_Template: This QTP based test script template is applicable only for creating data driven scripts and is not required in the Keyword driven approach. Note: The inserted document is shown in text format to eliminate the need to use QTP for viewing the file content.
d) KeywordDriven_BusinessFunctions_Template: This is used for developing the Keyword driven business functions. The file should be renamed and placed in the Test_Libraries folder when used for creating the Keyword driven business functions. All functions created in this file should have the fn_ prefix. Note: This template is used only in the Keyword driven approach. Please refer the Instructions worksheet for more details.
e) KeywordDriven_FunctionReferences_Template: This template is used for mapping the Keyword driven functions and the library files in which they are stored. This file should be renamed to KeywordDriven_FunctionReferences.xls and stored in the Test_Configuration folder. Note: This template is used only in the Keyword driven approach. Please refer the Instructions worksheet for more details.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 12 of 22
MS Word Portrait Template f) KeywordDriven_ActionFile_Template: This template is used for developing the Keyword driven scripts. The file should be renamed and placed in sub-folders that group logically related action files in the Test_Scripts folder. If there are a large number of test scripts in a module (For Ex: 500), then it is recommended to store the test scripts in multiple action files (probably 5 action files and each containing 100 automated scripts) to enable easy maintenance. Note: This template is used only in the Keyword driven approach as defined in the framework.
g) KeywordDriven_ActionFile_DriverScript_Template: This QTP based Test script template is used for creating the driver script that is used for executing the Keyword driven scripts that are stored in the Action files to which the driver is associated. The name and the location of the driver script should be the same as that of the action file to which it is associated. Please refer the Instructions worksheet for more details. It is mandatory that you create one driver script for each action file that exists. Note: This template is used only in the Keyword driven approach. The inserted document is shown in text format to eliminate the need to use QTP for viewing the file content.
Test_Documentation In this folder any documentation relevant to the Test Automation framework can be placed. The documents placed in this folder will not impact the execution of the automated scripts in any way.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 13 of 22
How to add Test Objects to a repository Exporting the Test Objects to a Shared repository
Conventions followed in naming Test Objects used in the Shared Object Repository a) It is mandatory that the logical name of each Test object across all the Shared Object repositories be unique.
Note that if OK button is present in two separate screens, it should be named differently when it is captured and stored in the Object Repository.
b) Create and store the project-specific shared test object repositories in the Test_Object_Repositories folder. c) The required Object repository files for the test should be manually associated to the corresponding QTP test script file in the data driven approach and in case of the Keyword driven
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 14 of 22
MS Word Portrait Template approach the required repository files should be associated to the corresponding action file driver script. Note: The standard procedure as defined in QTP for creating repositories and adding objects to a shared repository is followed in the framework. Refer to the QTP help file for details on updating or merging the test object repositories using the object repository manager.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 15 of 22
MS Word Portrait Template Common functions for automation of both Web-based and non-Web-based applications The table below lists some Utility functions that can be used for performing tasks/validations in GUI based applications. These functions can be used for developing automated scripts for testing applications that are either Web based or non Web based applications.
Function Name
Launch_Application Enter_Value_In_Edit_Field
Information on usage
Used to launch the browser or Windows-based application. Used to enter string values in default or encrypted form in Edit or Text fields of a GUI. Can also be used for entering data in the fields of terminal emulators with a character-based interface. Used on components that support the Click operation (push buttons, links, and images). Used to select or deselect a check box. Used to select or deselect a radio button. Used to select a specified value from a list of values in a drop-down list box. Used to select a value from a list of values in a drop-down combo box; selects a value that matches a partial string value that is specified as an argument. Used to compare the actual value of a property of the specified test object with its expected value. Used to close the browser or application that is being tested.
Functions used in Web-based applications only Some components like Web tables are specific only to the user interface of web based applications only. The framework provides the functions listed in the table below to work on tables that are present in the user interface of web based applications.
Function Name
Click_Link_In_WebTable Verify_Value_In_Table Get_Table_Row_Number Get_Table_Row_Number_Of_Ro w_Name Get_Table_Column_Number
Information on usage
Used to perform the click operation on a link in a Web table. Searches for a specified value in a Web table, and returns true if the item is found, else returns false. Returns the row number of the specified item in the Web table. Returns the row number when the name of the specified row in a Web table is passed as an argument. Returns the column number of the specified column name in the Web table.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 16 of 22
MS Word Portrait Template Functions used in Keyword driven approach only The framework supports developing automated scripts using the data driven or keyword driven approaches. The list of functions in the table below are specific only to the Keyword driven approach for developing automated scripts using the framework.
Function Name
Start_Test End_Test Start_Function End_Function Framework support functions
Information on usage
Used collectively to control the start and end section of each of the keyword-driven test scripts in the action files. It is mandatory for each keyword-driven test script to begin with Start_Test and to end with End_Test. Used collectively to control the start and end section of each of the keyword-driven functions. It is mandatory for each keyword-driven function to begin with Start_Function and to end with End_Function.
The following list of functions are used for developing the core logic in the framework and are not meant to be included (by function calls) directly in the automated test scripts that are developed.
Function Name
Set_Application_Type _Property Search_Associated _Repositories
Information on usage
Determines if the application being tested is Web-based or non-Webbased so that it can invoke the right method on specified objects. Searches for the logical name of the test object in multiple object repositories.
Please refer the inserted document for a listing of all Utility functions that exist in the Framework_Utility_Functions.vbs file.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 17 of 22
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 18 of 22
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 19 of 22
MS Word Portrait Template It is mandatory that all the Keyword driven functions that have been created for use in the keyword driven scripts be referenced in the KeywordDriven_FunctionReferences.xls file. Else there will be runtime error as the Action file driver script will not be able to locate and execute the steps of the corresponding keyword driven business function.
Procedure In a Non Quality center environment For initiating execution of scripts created using either the data-driven or keyword-driven approach on the local system, the script file named DriverScript.vbs is used. User can initiate the execution by double clicking on the DriverScript.vbs file. Using the information on the Module_Selection worksheet of the Test_Execution_Configuration.xls, the driver identifies all the modules whose scripts need to be executed by referencing the value Yes in the Execute column. For each of the selected modules, the driver identifies the worksheet with the same name as the module name and executes all the scripts that have been marked for selection by referencing the value Yes in the Execute column. The execution stops when all selected scripts of all selected modules have been executed.
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 20 of 22
Creation of Result Logs When execution is initiated on the local system using the test driver script: In the Test_Result_Log folder, a sub-folder named with the date-time stamp of when the execution was initiated is created. Under the date-time stamp folder, a sub-folder with the name of the module listed in the Module_Name column of the Module_Selection worksheet is created. For each of the automated scripts of the module that are selected for execution, corresponding sub-folders are created where the QTP-generated result files are stored.
For each cycle of execution, folders with names corresponding to the various date-time stamps are created for the result logs.
Script names
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 21 of 22
Note: The Test_Result_Logs folder will not contain any results when the execution is initiated from Quality Center.
14 KNOWN LIMITATIONS
The framework is developed by using QuickTest professional tool and does not support development of automated test scripts using any other Test automation tool like SilkTest or TestPartner or Selenium etc. The framework supports functional Test automation using QuickTest professional tool version 9.2 or higher only. The framework has not been tested on SAP or Oracle based applications due to lack of availability of these applications. But the assumption is that by using the appropriate add-ins, the existing Utility functions provided in the framework can be used for developing the automated test scripts on all QTP supported platforms.
15 ACKNOWLEDGEMENT
The following resources have contributed to the design and development of the framework. Meena Puttaraju Girish S Mohamed Yehia Vijay Raghavendra Ashok Reddy
Saved 5 November, 2008 EDS Internal Copyright 2008, Electronic Data Systems Corporation. All rights reserved.
Page 22 of 22