NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically create nested sub-sequence calls

Hello! I'm trying to programmatically generate TestStand sequences that have a nested sub-sequence structure. I've had success generating sequences in the past, but not with this structure. If you look at the attached images, you'll see that I'm trying to create a top-level sequence that calls another sequence. In that sequence there are n sub-sequences. Yes, I realize the structure is a bit more complex than strictly necessary, but I'm working within constraints imposed by the format of the requirements from which I'm creating the test sequence.

 

At present, my code is putting everything at the same level in the top-level sequence. Does anyone know how I go about getting the structure I want? I can manually arrange the sequence calls the way I want them, and the overall sequence runs with no problems, I just can't figure out how to get my LV code to do this for me.

 

Thanks!

0 Kudos
Message 1 of 9
(1,572 Views)

Do you need to create the sequences or can you make them ahead of time and always create/clear them out every time you run?

 

It looks like you're doing the right thing in the code snippet.  

 

I might create a new step in MainSequence/Main like this:

RunState.SequenceFile.GetSequenceByName("MainSequence").InsertStep(RunState.Engine.NewStep("","SequenceCall"),[index],StepGroup_Main)

 

In your case, wouldn't you just change the MainSequence text in that expression with one of the names of your newly created sequences?

 

Message 2 of 9
(1,550 Views)

I do need to create the sequences, I can't rely on some form of template as the structure of the governing requirements documents (CSV files I parse) will vary slightly. The assumption is that the created sequences will all be manually added to an existing top-level sequence that contains all the required setup and cleanup steps.

 

My hope had been that there would be a property such as Step.Module.SequenceCallModule.SequenceCall or something like that. That way I'd be able to operate on the newly created sequence reference (which gets inserted into MainSequence at Current Sequence Index + 1), but I'm not finding anything like that.

 

As to your suggestion, I can't really take that approach as I'm doing all of this within my own LV sequence generator application. If I can't create the nested sequences I want (which I should be able to do since I can create them in the Sequence Editor manually), I'd be happy with just being able to insert test steps into the newly created sequence, but that's not happening either. Everything gets created on the same level, whether it's a sequence call or a test step.

0 Kudos
Message 3 of 9
(1,516 Views)

Perhaps I am not understanding the problem.  To me it seems like what you should do is create your lowest level sequence and populate all the steps within it.  Then, create the sequence one level up and with calls to the other sequences.  And so on, until you add sequence call steps to MainSequence.

0 Kudos
Message 4 of 9
(1,511 Views)

Creating nested sequence calls through the TestStand API should be the same as creating flat sequence calls as it is not the sequences them selves that are nested but the calls to them.  I would say that you need to create your sequence in the normal way and when adding the steps to your subsequences will need to keep track of what subsequence is calling whatever other subsequence to give you the nested calling you require.

 

We created our own Word Document to TestStand Sequence convertor using LabVIEW 7.1 (oh the nostalgia!!) 10 years or so back so I know this sort of thing is possible but it is not exactly fresh in my mind.  I am back in the office tomorrow, I will have a look at the code and identify the calls.

0 Kudos
Message 5 of 9
(1,510 Views)

I suppose that might be possible, I've been looking at the task of creating the sequence file, sequence and step calls based on the source data. Essentially what happens is that I identify what the type of created step is to be: Sequence call (top-level), sub-sequence call (sequence call step in top-level sequence), or test step call (LV call step in sub-sequence, either Action or test type). My source data is an array of typedef clusters that gets populated from my CSV file parsing utility, this array then gets processed into TS steps and added into a newly-created sequence file.

So, I've been taking a top-down approach, rather than bottom-up as you suggest.

0 Kudos
Message 6 of 9
(1,503 Views)

The tracking of the calling sequence or sub-sequence by reference is the problem. I'd appreciate whatever help you can give me in that area.

0 Kudos
Message 7 of 9
(1,502 Views)

Found the solution! The trick was indeed to create all the sequences in MainSequence first. Once that's done I can just get the sequence of interest by name and create whatever type of step I want, be it a sub-sequence call or LV Action or test step.

 

Thanks!

0 Kudos
Message 8 of 9
(1,493 Views)

Happy days!

0 Kudos
Message 9 of 9
(1,479 Views)