Performs an unconditional branch (out of the normal program sequence) to a specified Test in the current running Task or in the current program.
Test [EndEvents] test-specifier [ Uut lUutIndex ]
The Test statement is like a jump. It does not return to the statement following the Test statement after the test is completed. ATEasy executes tests in a sequential order by default, so if you jump to test 3, test 4 will be called after that. When running from the test executive the next test after Test 3 is one in the tree view that is checked (selected for run).
You may choose to place some code in OnEndTest that will call the next test after the current test is completed. For example, in OnEndTest you can check the Test.Id or Test.Number or Test.Index to figure out what test was completed, you can also check Test.Status or check some global boolean variables or some number that will tell you what is the next test/task to execute. (Task.Id and Test.Id are unique in the application.)
The test-specifier can be an integer, string, or object expression. If test-specifier is a string expression, it should be the Id of any Test in the current program. If test-specifier is an object expression, it should be the Test object for any Test in the current program.
If test-specifier is an integer expression, it should be the test number (1-based) of a test in the current Task. For example, the following statement
Test 5
will jump to Test 5 (fifth test) of the current Task. If the fifth test does not exist, the statement will jump to next Task.
A Test number of -1 or 0 or any invalid number will terminate the current task.
Unless the EndEvents optional keyword is specified, the OnEndTest and OnEndTask events are not triggered for the current test and task which are being terminated. When Test statement is called within OnInitProgram, OnInitTask, OnInitTest, OnInit, or any other event, if the EndEvents optional keyword is specified, the OnEndTest and OnEndTask events will be called before starting the new test.
The statement generates a run-time error if test-specifier does not refer to a valid test (invalid expressions like 9.9), if a program is not being run, or if the program is being run in a special mode (such as Loop Test or Loop Task).
The optional keyword [ Uut lUutIndex] (introduced in ATEasy v8) specifies the UUT index that should be used. Omitting the clause will use the current UUT (default). The Uut clause sets the specified UUT index number (see App.UutIndex) as pending jump to the specified Task. That UUT must be running in sequential mode in order to work. When ATEasy switches to the specified UUT, the jump to the specified Task will be done.
The following example of an OnEndTest event procedure will retry each failed Test three times. If the Test continues to fail the Task is terminated:
Procedure OnEndTest(): Void Public
{
If TestStatus = FAIL
If iRetryCount < 4
iRetryCount = iRetryCount + 1
Test GetTestNum ( )
Else
Test -1
Endif
Else
iRetryCount=0
Endif
}
About Module Events, Initialization Events, End Events, OnEndTest, GetTaskTests, GetTestNum, Task Statement, Task Variable, Test Variable, App.UutIndex