Você está na página 1de 10

Effective QTP Automation Framework

Health Bai, Ms. Viji (Viji)


BFS

Effective QTP Automation Framework

Health Bai, Ms. Viji (Viji)


BFS

Effective QTP Automation Framework

Abstract
In this paper, we have presented a comparative study of the current processes followed in executing Quick Test Professional (QTP) Test script in the local system and QTP scripts in the Quality Center (QC). We have then proposed a more efcient way to execute tests and manage systematic control over the testing process.

1. Introduction
QTP is the automated Testing Tool that enables you to automate standard windows applications, Web applications and ActiveX controls. The Quality Center simplies and organizes test management by giving you systematic control over the testing process. It helps you create a framework and foundation for your testing workow. It also features a sophisticated system for tracking application defects, enabling you to monitor defects closely from initial detection until resolution. QC guides you through the requirements specication, test planning, test execution, and defect tracking phases of the testing process. Although the QC and QTP tools involve automating the testing process, eliminate human intervention is not completely eliminated. These tools do not support running of tests accurately on a periodic basis without human intervention. In this paper, we propose a method to run the scripts in a local system without eliminating the merits that we get by running the QTP scripts in the QC.

2. Model 1: Execution Flow in the Local System


For QTP execution in the local system, the QTP scripts run in the local system and the corresponding results are saved in the same system.

2.1. Execution Flow


The ow of execution of QTP scripts on the local system is depicted in the following diagram. Step 1: The versioned scripts and the resources taken from the perforce server are updated in the local system. Step 2: A windows scheduler set up in the local machine, which is nothing but a .vbs script, is used to run the QTP scripts. Step 3: Once the scripts are executed, the results are stored in the local system.

TCS Condential

Copyright 2007 by Tata Consultancy Services. No part of this publication may be reproduced, stored in a retrieval system, used in a spreadsheet, or transmitted in any form or by any means electronic, mechanical, photocopying, recording, or otherwise without the permission of Tata Consultancy Services.

Effective QTP Automation Framework


Client System V ersion Server R ecovery Scenarios Function L ibraries Scripts Submit / Update Data table & X ML Shared Object R epository

Main Scripts

R uns Shared L ocation Copy to Centralized place R esults R epository R esults

Execution of the QTP Scripts in the local system provides the following features: Versioning - Enables management of different versions of scripts in a separate server. Scheduler - Runs the scripts without the need of any frequent setups. Batch Run - Runs the tests as a batch; multiple scripts can be set up to run one by one in a specied order.

2.2. Version Controlling


In the era of distributed systems, versioning enables users across the world to access the updated scripts, and maintain different versions of the scripts on the server. Various versioning tools, such as Perforce, can be used on the client side. .

2.3. Test Scheduling


When the QTP scripts run in the local system, the test runs can be scheduled without human intervention. We used the normal windows scheduler available on windows operating system to schedule our tests. Windows scheduler provides us the feature to schedule application at a specied time. Moreover, it also provides the option to select dates based on specic days in a week or the rst day of month and so on.

TCS Condential

Copyright 2007 by Tata Consultancy Services. No part of this publication may be reproduced, stored in a retrieval system, used in a spreadsheet, or transmitted in any form or by any means electronic, mechanical, photocopying, recording, or otherwise without the permission of Tata Consultancy Services.

Effective QTP Automation Framework

The windows scheduler triggers the .VBS le, which contains the instructions to initiate a QTP script/batch of scripts, which in turn invokes the respective QTP scripts, runs them and stores the results in the local system at a location specied in the .VBS le.

2.4. Batch Scripts


Batch scripts enable us to group the test script and instruct them to run in a specied order. When we start the batch script (.VBS), the QTP is opened and the scripts are run in the specied manner.

2.5. Merits
Speed of execution is relatively faster as compared with the execution of the scripts in

QC. Development time of the script is faster as compared with development time in QC. Version controlled scripts. Automatic scheduler can be enabled with the help of VB scripting

2.6. Demerits
Results are not available in the centralized system. Defect tracking for the specied test at a given time is difcult. Test Plan mapping is not available; this is available in QC.

3. Model 2: Executing QTP Scripts in QC


The main purpose of this mode of execution is to make the results of everyday execution available in a centralized manner.

TCS Condential

Copyright 2007 by Tata Consultancy Services. No part of this publication may be reproduced, stored in a retrieval system, used in a spreadsheet, or transmitted in any form or by any means electronic, mechanical, photocopying, recording, or otherwise without the permission of Tata Consultancy Services.

Effective QTP Automation Framework

3.1. Execution Flow


The ow of execution of QTP scripts in QC is displayed in the following diagram.
Test Sets Test A Test B Test C

Locate Tests

QC (COM)

Run Tests

Connect to QC Quick Test Pro (COM)

Store Results

3.2. Merits
Results are stored in a centralized place. It is easy to track the defects. Coverage from Requirements to defects is available with this tool.

3.3. Demerits
Speed of execution is relatively slow when compared with the execution in the local

system. Versioning feature cannot be availed. Automatic Scheduling is not available with QC.

TCS Condential

Copyright 2007 by Tata Consultancy Services. No part of this publication may be reproduced, stored in a retrieval system, used in a spreadsheet, or transmitted in any form or by any means electronic, mechanical, photocopying, recording, or otherwise without the permission of Tata Consultancy Services.

Effective QTP Automation Framework

4. Model 3: Enhanced Framework


Since maintainability of the scripts plays a vital role in business, it is of foremost importance to follow standards are followed to ensure proper maintenance of the scripts. In this model, we keep test cases in QC and QTP scripts in the local system. The Windows scheduler used in the Model 1 is used to initiate the script in the local system. However, in the specication of the result path, we specify the path of the QC dummy test instead of the local system path. Thus, the results get stored in QC and therefore can be veried at any point of time for report analysis. We also have the advantage of version controlling in the local system with any client version controlling tool. In addition, performance is good when compared to running scripts from QC. Now, the proposed model of execution in this paper is in such a way that the merits of execution in the local system as well as the merits of execution in QC are retained.

4.1. Merits
Results in centralized place for future reference. Versioning available. Performance gained because of keeping the scripts in the local system. Automatic scheduling of tests is available. Following the QTP standards ensures maintainability. Defect tracking through QC ensures centralized access.

5. QTP Standards
We used the following standards to ensure that the scripts are maintained properly: Naming conventions - Meaningful names should be given to the various actions, objects (objects refer to the browser name, component name and so on), and variables used within the script. Modularity: Redundancy should avoided by usage of VB functions. Instead of writing code repeatedly, VB functions should be used for activities that require frequent usage. Checking for the existence of objects - Before we use any object inside a script, it would be useful if we could check for the existence of the object. This would avoid the script leading to unintended results Data validation - When data entered in the application is not valid, it is useful to exit the current iteration and report the same in the result and move to the next iteration. Data validation should be handled before any operation specic a test case.

TCS Condential

Copyright 2007 by Tata Consultancy Services. No part of this publication may be reproduced, stored in a retrieval system, used in a spreadsheet, or transmitted in any form or by any means electronic, mechanical, photocopying, recording, or otherwise without the permission of Tata Consultancy Services.

Effective QTP Automation Framework

User dened environment variables - User dened environment variable should be used where we want to share the value of the variables across multiple scripts. Shared Object Repository - Instead of storing the GUI objects of each action, it is useful to store the objects in a shared repository, which can be referred globally. Entities in different folder Keeping different entities in different folders related to the test is useful for future maintenance. In this case, separate folders should be used for the VB scripts (.vbs), Data table sheet (Excel sheets), Environment le (XML le), and repository (.tsr), recovery (.qrs) and scripts. Relative paths - Relative paths should be used to refer the various external resources. In such a case, even when the resource is moved to some other location, additional work of referring the new location of the resources is avoided. Defect tracking through QC The test management tool, QC, is used to track the defects. Therefore, defects are accessible in a centralized place and we can prepare different kind of analysis report through this tool.

6. Acknowledgments
We would like to thank our entire project team for their valuable inputs on the various processes involved, which went a great way in improving the quality of the paper. In addition, we would like to acknowledge all our mentors and managers for helping out in every possible way.

7. References
Quick Test Professional Help

TCS Condential

Copyright 2007 by Tata Consultancy Services. No part of this publication may be reproduced, stored in a retrieval system, used in a spreadsheet, or transmitted in any form or by any means electronic, mechanical, photocopying, recording, or otherwise without the permission of Tata Consultancy Services.

Effective QTP Automation Framework

Contacts
Viji Health Bai 415/ 21-24, Kumaran Nagar | Sholinganallur Road Chennai 91-9840724556 Viji.healthbai@tcs.com VimalRaj Selvaraj 415/ 21-24, Kumaran Nagar | Sholinganallur Road Chennai 91-9884246252 Vimalraj.Selvaraj@tcs.com

TCS Condential

Copyright 2007 by Tata Consultancy Services. No part of this publication may be reproduced, stored in a retrieval system, used in a spreadsheet, or transmitted in any form or by any means electronic, mechanical, photocopying, recording, or otherwise without the permission of Tata Consultancy Services.

Você também pode gostar