OnInit Event (ASystem, ADriver, AProgram)

Occurs when a module is initialized.

Syntax

Object.OnInit()

The OnInit event syntax has the following parts:

 

Name

Type

Description

Object

ASystem, ADriver, AProgram

Module object

Comments

The OnInit events apply to the Program, Driver and System modules. ATEasy will call first the System OnInit event (if exist) then the System Drivers (if exist in your project), and the System OnInitSystem. For each program that ATEasy will run, ATeasy will call its program OnInit event. If the event procedure does not contain code then ATEasy will not call the event.

The following list shows the order of OnInit events combined with default output (see ModuleEvents.prj example for more information). After the Program OnInit is called, ATEasy will output the program header to the log as shown here. The log output can be override to create custom output using SetLogString function:

 

   * System.OnInit

   * Driver1.OnInit

   * Driver2.OnInit

   * System.OnInitSystem

ATEasy Test Log.

----------------

Company... :

User name. : RonnieY

Project... : ModuleEvents

Version... : 1 (Wed Oct 26 05 18:43:29)

   * System.OnInitSwitchUut

   * Driver1.OnInitSwitchUut

   * Driver2.OnInitSwitchUut

   * Program.OnInitSwitchUut

   * System.OnInitProgram

   * Driver1.OnInitProgram

.\ModuleEvents.prg

   * Driver2.OnInitProgram

.\ModuleEvents.prg

   * Program.OnInit

================================================================================

Program... : Example

UUT....... :

Version... : 1 (Fri Nov 05 10 08:52:27)

Serial #.. :

Start time : 11/8/2010 4:25:12 PM

   * System.OnInitTask

Use the OnInit events to initialize the specific module before any of the code in that module is executed. You can also redirect ATEasy to ignore and not to continue calling other modules OnInit by running another program, task or test using the Run, Task and Test statements. If the event returned normally (not ignored) ATEasy will continue to call all the OnInit events for other modules.

Example

The following is an example of one way to use the OnInit event:

Program.OnInit()

{

! ... program initialization code ...

print "Program "; Program.Name; " has been initialized for execution."

}

Applies to

ASystem, ADriver, AProgram

See Also

OnEnd, OnInitTask, OnInitTest, OnInitSystem, Run Statement, Calling Sequence of Module Events, Initialization Events, About Module Events