NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to dynamicaly skip steps via PreStepCallback

Hi,

I've got an Operator Interface launching a MainSequence sequence in TestStand. I would like at some point to be able to launch execution of my sequence by providing a list of stepIds to skip. Sending all the information down to TestStand is no problem.

Problem is that I don't realy want to start putting pre condition on all steps, seems to be too maintenance intensive on the long run. I was thinking of using a SequenceFilePreStepCallback to be able to dynamicaly execute or not the next step. I played around with the TS.PreCond of the step, but it seems the precondition is already evaluated before the callback is called.

Does any of you have a clever idea on how I could force to skip the step from a PreStepCallback point of view?

Otherwise, I guess I could open the sequence in memory, programaticaly change some pre condition and then launch the execution. But then, if I have multiple sequence file and multiple sequences it may get too complicated for nothing.

What do you think?

Thanks,

Mathieu Daigle
www.averna.com
0 Kudos
Message 1 of 6
(3,725 Views)
Hi,
 
 
You can change the run state by setting the Step.TS.Mode to "Skipped". If you do this in the PreStep callback use RunState.Caller.RunState.NextStep as the lookup string.
 
Regards
Ray
Regards
Ray Farmer
0 Kudos
Message 2 of 6
(3,721 Views)
Let's say I have:

Step1
Step2
Step3

When I try to do the trick you told me, if I am in the PreStep of Step1, RunState.Caller refers to Step1, doing a RunState.NextStep.TS.Mode changes the mode for Step2, not Step1...

My question in fact is to see if it is doable to change Step1's mode while executing the Step1's own PreStepCallback.
0 Kudos
Message 3 of 6
(3,716 Views)
re: 'My question in fact is to see if it is doable to change Step1's mode while executing the Step1's own PreStepCallback.'
 
At this point the run mode has already been checked, so changing it won't help.  However, you can set Step.CancelExecution to True. This property is intended for implementing custom pre-condition-like behavior.  Note that you'll need to set the status of the step to "Skipped" if you don't want it to default to "Done". 
Message 4 of 6
(3,711 Views)
Wonderful. This works like a charm.
For the benefit of everyone, here is the help for that property:

CancelCurrentExecution Property

Syntax

Step.CancelCurrentExecution

Data Type

Boolean

Purpose

When set to True, TestStand does not call the step module, subsequent substeps, or the PostStep callback for the step, nor does it evaluate the post expression or status expression.

Remarks

This property is reset to False after TestStand uses it so that the step will run normally the next time it executes. You can set this property from the Pre- or Post-step substep of a step type. By setting this property to True in the Pre-step substep, you can use this property to impose additional conditions that a step must meet before it can execute.

See Also

CancelStepCallback


0 Kudos
Message 5 of 6
(3,707 Views)

Hi,

Yeah sorry should have said that you will only beable to set the skip status for the next skip as it will already have started the execute the current skip.

Regards

Ray Farmer

Message Edited by Ray Farmer on 09-10-2007 06:40 AM

Regards
Ray Farmer
0 Kudos
Message 6 of 6
(3,693 Views)