Taking action on problems
You can provide TestArchitect with specific instructions as to what to do when a problem occurs.
In many cases when an error or test failure occurs, it is necessary not just to interrupt the normal flow of processing, but to take some specific action or set of actions. Such actions might include:
- returning the AUT to some known state, to allow for testing to continue
- shutting down the AUT altogether
- logging a report
- capturing some aspect of the state of the AUT, to allow for analysis of the problem at some later point in time.
Two actions serve this purpose:
Allows you to specify an action to be executed in the event of an error
Let you specify the action to be executed in the event of a check failure.
The action that you specify may be a built-in action, but in most cases it is likely that you will want to call a dedicated user-defined action to handle the error or failure.
As an example, the following is a simple error handler that, when called, merely writes out a report to the effect that an error occurred, and captures the screen at the time of the error, saving it to a designated jpg file:
A test module that uses this handler is shown below:
The on error action action specifies the error handler. (Note that on error action need not necessarily be limited to the INITIAL section of the test module, and you are not limited to specifying a single error handler within the test module. Indeed, it is possible to have on error action calls scattered throughout your action lines, so that the appropriate handler is invoked for each given place in which an error is possible.)