NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to iterate through sequence steps and subsequences before executing them?

Hello,

Background:
I am trying to write a VB ActiveX DLL routine to perform some sanity
checking on a loaded sequence file before any of steps in the sequence file
are executed. We have several custom step types. One of the properties of
our custom step types is a "result code". Valid "result codes" are stored
in a remote SQL Server database and since the result codes may be changing,
they must be verified at run time (otherwise the UUTs might get assigned an
invalid result code). I was hoping to iterate through the sequence file and
check all the steps that are our custom step types and not allow testing to
continue if an invalid result code is encountered.

Problem:
I have figured out how to iterate through the steps of a the MainSequence.
The code below is a sample on how I was planning to do this. My problem is,
most of our test sequences contain calls to other sequences that also
contain our custom step types. I need to recurse through the sequence
"tree" and check all sequences and subsequences that may be run for valid
result codes. While I can easilly determine if a step is a sequence call
(Step.IsSequenceCall) I can not find a way to obtain references to the
sequence file and sequence that the step calls. I have checked the
SequenceFile, Sequence and Step object methods and properties and can find
nothing that will allow me to accomplish this. If I could get the name of
the sequence file and sequence, I could easilly get the references. But I
can not even find a way to even retrieve the name of the sequence file and
sequence the sequence call step calls.

What am I missing? Is obtaining this information possible?

Any help would be greatly appreciated,

Bob Rafuse
Etec, Inc.


' ***********************************************************************
Public Sub VerifySequenceFile(tsobjSequenceContext As TS.SequenceContext)
Dim tsobjProperty As TS.PropertyObject
Dim tsobjClientSequenceFile As TS.SequenceFile
Dim tsobjSequence As TS.Sequence

Set tsobjClientSequenceFile = tsobjSequenceContext.ProcessModelClient
Set tsobjSequence =
tsobjClientSequenceFile.GetSequenceByName("MainSequence")

' verify all step groups...
VerifySequence tsobjClientSequenceFile, tsobjSequence, StepGroup_Setup
VerifySequence tsobjClientSequenceFile, tsobjSequence, StepGroup_Main
VerifySequence tsobjClientSequenceFile, tsobjSequence, StepGroup_Cleanup

Set tsobjSequence = Nothing
Set tsobjClientSequenceFile = Nothing
End Sub
' ***********************************************************************
Private Sub VerifySequence(tsobjSequenceFile As TS.SequenceFile,
tsobjSequence As TS.Sequence, tStepGroupParam As TS.StepGroups)
Dim tsobjStep As TS.Step
Dim i32NumSteps As Long
Dim i32StepIndex As Long

i32NumSteps = tsobjSequence.GetNumSteps(tStepGroupParam)
For i32StepIndex = 0 To (i32NumSteps - 1)
Set tsobjStep = tsobjSequence.GetStep(i32StepIndex, tStepGroupParam)

' is this step a sequence call?
If (tsobjStep.IsSequenceCall) Then

' ************************************************
' PROBLEM: How do I get references to the
' sequence file AND sequence this step calls???
' ************************************************

ElseIf
' TODO: Check to see if step is custom step type and
' if so perform result code check here...
' Raise error if invalid code is encountered...
End If

Set tsobjStep = Nothing
Next i32StepIndex
End Sub

' ***********************************************************************

0 Kudos
Message 1 of 4
(3,500 Views)
Bob,

The SequenceCall adapter properties that you need are hidden. See NIDZ document called Hidden Properties of TestStand for more details (link below). Please note the last warning in this documents. Using these properties you can get either the relative or abosolute sequence file path (depends on how you configured it) and called sequence name. If only the relative path is available then you will have to use the FindFile API method to obtain the absolute path to the sequence file.

Finally, if your called sequence or sequence file is determined by an expression at runtime, you may not be able to resolve the path with your utility. You should account for this possibility.

Let me know if you need more information.

http://zone.ni.com/devzone/conceptd.nsf/2
d17d611efb58b22862567a9006ffe76/246f6c77f5ad473e86256a2c0055c0d0?OpenDocument
0 Kudos
Message 2 of 4
(3,500 Views)
> The SequenceCall adapter properties that you need are hidden. See
> NIDZ document called Hidden Properties of TestStand for more details
> (link below). Please note the last warning in this documents. Using
> these properties you can get either the relative or abosolute sequence
> file path (depends on how you configured it) and called sequence name.
> If only the relative path is available then you will have to use the
> FindFile API method to obtain the absolute path to the sequence file.
>
> Finally, if your called sequence or sequence file is determined by an
> expression at runtime, you may not be able to resolve the path with
> your utility. You should account for this possibility.
>
> Let me know if you need more information.
>
>
http://zone.ni.
com/devzone/conceptd.nsf/2d17d611efb58b22862567a9006ffe76/246
f6c77f5ad473e86256a2c0055c0d0?OpenDocument

Nemo,

Thanks! I'll give that a shot...

Bob.
0 Kudos
Message 3 of 4
(3,500 Views)
Nemo,

That worked great... thanks!

Bob.
0 Kudos
Message 4 of 4
(3,500 Views)