NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programmatically run a single step in a different sequence file?

From Sequence 'A' I would like to programmatically execute a single step in subsequence 'MySequence' which is in sequence file 'B'.
0 Kudos
Message 1 of 4
(3,960 Views)

There are a few of options, but I would say it really depends on why you are trying to do this. If you tell us why I can probably better recommend which option would be best.

 

1) Rather than call an individual step in one sequence from a another, if what you really want to do is just have a standard kind of step that you use in multiple places I'd recommend using a step type instead with a postsubstep that calls the code that does the thing you want to do. You could then insert multiple instances of that step whereever you need to do that thing and when you update the step type it would update the instances.

 

2) Another option is if you really want to reuse more than just the step, but other things in the sequence as well, I'd recommend moving the parts of the sequence you want to share into its own sequence and calling it from multiple places.

 

3) If neither 1 or 2 apply, I don't really recommend doing this from a normal test sequence execution, but you could create an interactive execution (i.e. the equivalent of saying Run Selected Steps from a UI). Look at the API help for APIs related to interactive executions.

 

If you post more details about why you want to do this and what you are trying to accomplish, we might be able to come up with a better solution.

Hope this helps,

-Doug

 

0 Kudos
Message 2 of 4
(3,955 Views)

The unit of programming in TestStand is the sequence. If you want to dynamically call something from TestStand, it'll have to be a sequence. You can use a GoTo statement, or Preconditions or other ways to just execute specific steps, but that will happen within some sequence execution. Another way to look at it is, the NewExecution method takes a sequence as a parameter, there is no "StepExecution" method. Without knowing more about it I'd say you'd need to encapsulate each step within a subseq, 'My Sequence1,' 'My Sequence2,' etc. or set up 'MySequence' with parameters so when you call 'My Sequence' it skips all the steps execept the one you want. Or you could handle it outside of TestStand by having a step that dynamically calls different code modules from within the step. There's probably a better solution, but I'd need more context.

cc

0 Kudos
Message 3 of 4
(3,949 Views)

Hi,

 

There are plenty of examples that show how to dynamically create a step in a sequence, one you will find in the Teststand examples folder, build sequence. Its uses a text file to define want steps to insert into sequence from another sequence, that's probably not what you want back the mechanism for creating the sequence to run is there.

 

You would need to use the Clone() method to obtain your step from another sequencefile/sequence to insert into a sequence that you run.

 

If your steps are common in nature, then use a custom step type, then you can obtain the step from a palette. to insert into your sequence.

 

Regards

Ray

Regards
Ray Farmer
0 Kudos
Message 4 of 4
(3,941 Views)