Run Statement |
modified v8 |
Runs one or more ATEasy programs. Execution of the current program(s) is terminated and then the specified program is run.
Run [EndEvents] [ program-specifier ] [ All | Uut iUutIndex ]
The program-specifier can be a string expression or object expression. If program-specifier is a string expression, it specifies the program shortcut name. If program-specifier is an object expression, it can be the AProgram object for any program in the current project (see App.Programs property).The statement generates a run-time error if program-specifier does not refer to a valid program.
When Run statement is called within the OnInitProgram/OnInit, OnInitTask, OnInitTest, or any other events and if the EndEvents optional keyword is specified, all end events, OnEndTest, OnEndTask and OnEndProgram/OnEnd, will be executed before starting the new program.
Without the EndEvents optional keyword, the OnEndTest, OnEndTask and OnEndProgram/OnEnd events are not triggered for the current test and task which are being terminated.
In ATEasy v8 the All and Uut optional clauses were added to support multiple UUT execution. When these keywords are used, you can specify the Run statement with or without the program-specifier. If no program-specifier was specified than the current set of the App.UutProgram is used, if the program-specifier is used it will change the App.UutProgram to the specified program. When using the Uut keyword the iUutIndex specifies the UUT index where the run is executed, this number must be in the range of 0 to App.UutCount-1. The run statement will attempt to reuse (if created) or create a thread if the specified UUT run mode is set to aUutRunModeParallel (AApp.UutRunMode). In Sequential run mode, specifying the Uut clause will cause the Run statement to execute after ATEasy switches to the UUT and is not an immediate jump.
This statement is not supported when called from within an ATEasy DLL (ATEasy program are not supported)
In ATEasy v2 the program-specifier string expression was a filename, if you are migrating from ATEasy2 you must change it to a program shortcut.
! run the 4th program ( index = 3 ) in the current
project ( application )
Run App.Programs(3)
! restart the current program
Run Program
! when ATEasy switches to uut 1, it will restart
the program running on that UUT
nUnit=1
Run Uut nUnit
! when ATEasy switches to uut 1, it will restart
the program running on that UUT
nUnit=1
Run Uut nUnit
! end current programs in all uuts and run "program1"
in all uuts
Run EndEvents "Program1" All
! end current program in UUT 0 and run Program1
when switched to UUT 0
Run EndEvents "Program1" Uut 0
The following example shows how to implement jumping to any Project Program test.
From your program call to jump to "xyz" program, Task 3, test 2 (as an example:
JumpToProgramTest(App.Programs("xyz"), 3, 2)
Define two System variables in the system to hold the next task
and test to run:
m_iNextTask:Long ! next task to run, 0 for continue
to the next
m_iNextTest: Long ! next test to run, 0 for continue to
the next
and this System Procedure:
System.JumpToProgramTest(prg, iNextTask, iNextTest)
prg : Val AProgram
iNextTask : Val Long
iNextTest : Val Long
{
m_iNextTask=iNextTask
m_iTest=iNextTest
if prg<>Program !
jump to another program
Run EndEvents, prg
else !
jump in the same program
Task EndEvents, m_iNextTask
endif
}
and these events:
System.OnInitProgram()
{
!
handle jump to a task
if m_iNextTask<>0
Task EndEvents, m_iNextTask
endif
}
System.OnInitTask()
iTest : Long
{
!
handle jump to a test
if m_iNextTest<>0
m_iNextTask=0
iTest=m_iNextTest
m_iNextTest=0
Test EndEvents, iTest
endif
}
Note that If you are using the test executive, you will have to
use the test executive commands to load program and run tests. You can
also use the ATEasy Profile.drv to achieve the same thing by creating
a profile and running it.
Abort, Exit, WinExec OnInit Event, OnInitProgram Event, Program Variable, AApp.UutCount, AApp.UutProgram, AAppUutRunMode