Creating Tasks During Runtime

Semrah O.
Salt Lake City, UT

Feb 20, 2025
2 Posts

0  |  0  

Re: Creating Tasks During Runtime

I have a task that I do consistently but at 200+ frequencies. I want to go through each one even if a task fails. What I would like is for there to be a task for every single frequency. Besides for manually copying the task 200 times and changing the frequency variable is there way to automatically set a parameter and initiate a task during runtime?

Solution Available
John
Irvine, CA

Feb 20, 2025
14 Posts

2  |  0  

Re: Creating Tasks During Runtime

Hello,

You can create a procedure RepeateTest() in the Program and call it at the end of the Test you want to Run n Times

The parameter you will pass is the nTimes you want to run the test.

Procedure RepeatTest(nTimes):Void
----------------------------------
nTimes: Val Short
i: Long
s: String
{
TestStatus=NONE

s=GetLogString(aLogStringCalcTestStatus)
i=Pos(Format(Test.Index+1, "00"), s)
s=Left(s, i)+Format(iTestIndex, "00")+Mid(s, i+Len(Format(Test.Index+1, "00")))


SetLogString(s)
if iTestIndex    iTestIndex=iTestIndex+1
    if (App.Flags and (aFlagsTestit or aFlagsDoitLoopit))=0
        Test endevents Test
    else
        iTestIndex=0
    endif
else
    iTestIndex=0
endif
}

Define a test that you want to run.  Perform the test as normal(e.g setting frequency, test limits, etc.) Then Call RepeatTest(200) at the very end.

You will need to define a program variable, iTestIndex to track how many times you test has run.

John

Semrah O.
Salt Lake City, UT

Feb 21, 2025
2 Posts

0  |  0  

Re: Creating Tasks During Runtime

Awesome, this is great! Thank you for taking the time to write this out for me.



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]