on error action
Specify the action to be invoked in the event of an error.
Name | Description | Type | Modifier |
---|---|---|---|
action | Name of the action to be executed upon the occurrence of an error or warning. | String | None |
argument<index> | (Optional) Arguments to be passed to the action specified in the action argument. | String | None |
None
This action may be used within the following project items: test modules and user-defined actions.
Example - Case 1: The error handler action has no arguments
Action lines
In TestArchitect, create a user-defined action named "error handler" with below sample script.
image location
capture screen D:\Images\error_img.jpg
Input the user-defined action "error handler" for the "action" argument of the "on error action" action. In this way, the script will call the "error handler" action when the execution gets an error.
Initial
level
set notice level 0
 
action
on error action error handler
 
config
 
start application
Test case: TC 01, 'on error action' works properly on an undefined control
window
check window exists login
 
window control
click login sign up
Result
Example - Case 2: The error handler action has arguments
In TestArchitect, create a user-defined action named "error handler" with below sample script.
name
argument argument1
argument argument2
 
text
report #argument1
report #argument2
Input the user-defined action "error handler" for the "action" argument of the "on error action" action. In this way, the script will call the "error handler" action when the execution gets an error.
Initial
action argument1 argument2
on error action error handler The first argument's value The second argument's value
Test case: TC 01, 'on error action' works properly with an undefined high-level action
force error
Result
- The number of optional arguments depends on the requirements of the action specified in action.
- This action supports the <ignore> modifier. If the string
<ignore>
is present as the value of any of the arguments, or any argument contains an expression that evaluates to<ignore>
, the action is skipped during execution.