Book Image

Designing and Implementing Test Automation Frameworks with QTP

By : Ashish Bhargava
Book Image

Designing and Implementing Test Automation Frameworks with QTP

By: Ashish Bhargava

Overview of this book

<p>As software testing is maturing, the focus is shifting towards test automation. The key is to learn and grow skills in framework designing and start contributing to project organization goals.</p> <p>Through a helpful mix of conceptual and practical aspects, you will learn everything you need to know related to the implementation of frameworks using QTP. Through simple examples, you will gradually develop the skills needed to execute concepts and code blocks used to design and implement the test automation framework.</p> <p>This tutorial-based guide demonstrates an easy way to implement concepts to create a portable framework across the various versions of QTP. You will learn about the automation lifecycle and gradually develop technical concepts related to each phase. Within a short amount of time, you will be able to deal with challenges in test automation. "Designing and Implementing Test Automation Frameworks with QTP" uses a simple, yet elegant approach and gives the reader all the skills and knowledge they need to implement the framework.</p>
Table of Contents (15 chapters)
Designing and Implementing Test Automation Frameworks with QTP
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Automation Life Cycle and Automation Goals
Index

Error handling


Exception handling is the way to deal with abnormal or exceptional events that interrupt the normal flow of test execution. For example, when a floating point number is divided by zero (0), it stops execution and an error message is displayed as shown in the following piece of code:

Type in the QTP editor   
Result = 5 / 0
'When test runs the preceding line, it will display Error Division by zero

The Err object in VBScript holds the details of the runtime errors, allowing continued execution despite a runtime error.

If the On Error Resume Next statement is absent in the script, any runtime error will stop execution and display the error message as shown:

On Error Resume Next
Result = 5 / 0 
'The above line will not display any error

Using the On Error Resume Next statement allows us to continue with the exception, but it is necessary to deal with the error using the Err object and come out clean from the erroneous condition.

The properties of the Err object are as follows:

  • Description...