Passing arguments to error handlers

Error and failure handlers can be made more flexible by having them accept arguments.

The actions on error action and on failure action can both accept an unlimited number of user-defined arguments. These arguments are passed to the handler specified by the action argument. This feature greatly increases the potential utility of your handlers, by allowing information specific to the error/failure to be logged. It also increases their universality, obviating the need to create a different handler for each type of problem.

In the example given, a handler action, my failure handler, is set up so that it will be passed two arguments, information and clean up, when called. information holds a message to be logged with the failure, and clean up is a flag indicating whether testing should continue (clean up = no) or everything should be shut down (clean up = yes).

When invoked, my failure handler does the following:

In this form, the failure handler can be called from multiple places within a test, with a response specific to the needs of the test at that particular point of failure.

The test case below makes use of my failure handler. It runs a check that (erroneously) expects the Car Rental Login window to have been dismissed. But before that, it sets up an on failure action, to force my failure handler to be invoked in case of a failure, and passes it a specific message plus a clean up flag indicating that everything should be shut down.

In the results page generated after the test is run, a Log Information section is created, with the following entry, reflecting both the message passed to the handler, plus the name of the capture file:


Copyright © 2023 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1(800) 322-0333