Using Program Events to Control Program Flow

ATEasy provides built-in events for the Program, System, and Driver modules to give you greater control over debugging and running your application. You can use events with programs to customize the test log and to control the flow of the program by scheduling tasks and tests using the Task and Test statements. If you do not add code to an event, the event is not called by ATEasy.

This topic describes how program module components (that is, programs, tasks, and tests) use OnInit and OnEnd events. The system and driver modules also use events. For information on all event types, see Module Events.

Initialization (OnInit) Events

An OnInit event occurs as soon as the module is initialized. The OnInit events are useful for initializing variables, activating drivers and boards, deciding which procedure to run next based on test results, etc. The OnInit events that are used by programs, tasks, and tests are:

OnInit--This event is processed by the Program module when the first program is activated.

OnInitTask--This event is processed when each task is started.

OnInitTest--This event is processed when each test is started.

Ending (OnEnd) Events

An OnEnd event occurs as the last step before a module is deactivated. These events are useful for outputting test results to the Test Log, deciding which procedure to run next based on test results, deactivating electrical power to systems, etc. OnEnd events are processed after the OnInit events. The OnEnd events that are used by programs, tasks, and tests are:

OnEndTest--This event is processed as the last action before a test ends. You can use OnEndTest to output the TestResult to the Test Log and/or to decide which step to do next based on the test results.

OnEndTask--This event is processed as the last action before a task ends. The user decides which step to do next based on the task's results.

OnEnd--This event is processed as the last action before a program ends.