Introduction:
Unexpected events during a test run disrupt a test or may give invalid test results. For example, during a test run, an application error may occur. This error does not permit the automated test to navigate to the feature, screen, or module that needs to be tested. These unexpected errors and events are called exceptions. It becomes important to handle these exceptions so that we are able to continue with automated testing even in unattended mode. Handling of exception in a manner so that test execution is uninterrupted is known as error handling.
Following are the ways in which error handling can be implemented in QTP.
• VB Script Error Handling
o Using Test Settings
o Using On Error Statement
o Using Err Object Properties
o Using Exit Statement
• Recovery Scenarios
Unexpected events during a test run disrupt a test or may give invalid test results. For example, during a test run, an application error may occur. This error does not permit the automated test to navigate to the feature, screen, or module that needs to be tested. These unexpected errors and events are called exceptions. It becomes important to handle these exceptions so that we are able to continue with automated testing even in unattended mode. Handling of exception in a manner so that test execution is uninterrupted is known as error handling.
Test Settings : Error Handling
Error Handling can be defined in Test Settings through File>Settings>Run as shown below:
It defines the possible actions in case an error is encountered during run session
Test Settings for error handling |