NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Test Steps in a sequence.

Using Test Stand 3.5 and C#.NET.  Need to know how to read all test steps in a sequence.  Does anyone have examples on how to do so programmatically?
0 Kudos
Message 1 of 5
(3,611 Views)
Hello Bobby,

here is example code for getting sequence steps in C#:

IEngine engine = this.axApplicationMgr.GetEngine();
SequenceFile seqFile = engine.GetSequenceFileEx("YourSeqFilePath", GetSeqFileOptions.GetSeqFile_OperatorInterfaceFlags, TypeConflictHandlerTypes.ConflictHandler_Error);
Sequence seq = seqFile.GetSequenceByName("MainSequence"); // Steps in MainSequence
int stepCount = seq.GetNumSteps(StepGroups.StepGroup_Main); // Steps in MainSequence
for (int i = 0; i < stepCount; i++)
{
    Step seqStep = seq.GetStep(i, StepGroups.StepGroup_Main); // Steps in MainSequence
    ...... // Your code here
}
......
engine.ReleaseSequenceFileEx(seqFile, 0);
Regards
MY
0 Kudos
Message 2 of 5
(3,588 Views)
Code example works great.  Couple more questions.... 
 
1. The Test Stand sequences were developed with CVI.  When I run the code and get to the line in your example

SequenceFile seqFile = engine.GetSequenceFileEx(YourSeqFilePath, GetSeqFileOptions.GetSeqFile_OperatorInterfaceFlags, TypeConflictHandlerTypes.ConflictHandler_Error);

it opens a dialog box and I have to search for a few DLLs.  Is there a way to add the DLL path or include them so this won't popup every time?

2. Can you filter out what type of steps the sequence contains?  Meaning, if I wanted to only see the Numerical Limit type steps in the sequence?

Thanks again.

0 Kudos
Message 3 of 5
(3,580 Views)
Hi Bobby,

to your first question: i think the GetSeqFileOptions "GetSeqFile_NoOptions" should be right for you.
to your second question: you can get the step type for a step and the name of it.

Try following code instead,  and let me know if it works.

IEngine engine = this.axApplicationMgr.GetEngine();
SequenceFile seqFile = engine.GetSequenceFileEx("YourSeqFilePath", GetSeqFileOptions.GetSeqFile_NoOptions, TypeConflictHandlerTypes.ConflictHandler_Error);
Sequence seq = seqFile.GetSequenceByName("MainSequence");
int stepCount = seq.GetNumSteps(StepGroups.StepGroup_Main);
for (int i = 0; i < stepCount; i++)
{
    Step seqStep = seq.GetStep(i, StepGroups.StepGroup_Main);
    StepType stepType = seqStep.StepType;
    string stepTypeName = stepType.Name;
// StepType in String
    ......
}
engine.ReleaseSequenceFileEx(seqFile, 0);
Regards
MY
0 Kudos
Message 4 of 5
(3,574 Views)
The GetSeqFile_NoOptions did not work, but I figured out what it was. I did not have my search directories setup correctly.  When I tried opening the sequence in Test Stand it asked me for the DLLs, as well.  To fix it, I had to click Configure -> Search Directories and add the directory where the DLLs were stored.
 
The step type and name helped.
 
Thanks again.  You provided the info I needed.
0 Kudos
Message 5 of 5
(3,570 Views)