NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the name of a previous test?

Solved!
Go to solution

Hi,

 

The top level of my sequence is a list of subsequences, each one being a  sub-test.

 

While inside one particular sub-test I would like to know the name of the sub-test which was executed before the one I'm in at the moment.   Obviously this is relevant only when I run selected sub-tests.

 

example:

        MyTest.seq

             sub-test1

             sub-test2

             sub-test3

 

I'm inside sub-test3 (in the setup or main sequence), and would like to know the name of the sub-test which was executed before sub-test3.  It is possible that no sub-test ran before sub-test3.

 

Thanks

RK

0 Kudos
Message 1 of 8
(4,183 Views)

Hi Rafi,

 

Try RunState.PreviousStep.Name()

 

Do a check if PreviousStep exists by using PropertyObject("", 0) with RunState.PreviousStep as the reference.

 

Hope this helps

 

Regards

Ray

Regards
Ray Farmer
0 Kudos
Message 2 of 8
(4,175 Views)
Hi Rafi,

Just in case you are using an earlier version of TestStand than 4.0, you might consider using the NameOf() function since you wouldn't be able to directly access the TestStand API through expressions.  Here are a couple articles to look into.

Getting the Name of Any TestStand Property Programmatically in TestStand
Storing Step Names of a Sequence in a Local Variable

Let me know whether the suggestions above point you to a solution. 
Rod T.
Message 3 of 8
(4,155 Views)

Thanks Ray,

 

Previous step does not work because I'm verifying it within a sub-sequence (see my example).  Previous step, then, will give the name of the stop executed previously to the present step.  THIS IS NOT WHAT I WANT.  I'm looking to find out the name of the sub-sequence that ran before the sequence i'm in.

 

example

   MainSequence

          sub-seq-1

          sub-seq-2

          sub-seq-3

 

I'm inside sub-seq-3.  I run a partial test and therfore I would like to know whether sub-seq-2 ran previously or not.

 

(I can work it out, using a local variable but I'm interested to learn how to find it using the RunState variables.)

 

Thanks

 

0 Kudos
Message 4 of 8
(4,100 Views)

Hi Rod,

 

Thanks for the links and especially to the one with the example.  Indeed some example!!  I ran it and was overwhelmed by that one step that creates a whole array of steps name.   Very nice.  I will take me some time to digest it...but I got the idea. 

 

Besides this, I'm still looking for a simple way to find just the name of the sub-seq that ran before the present sub-seq (please see my answere to Ray).

 

Thanks

Rafi

0 Kudos
Message 5 of 8
(4,097 Views)

Hi Rafi,

 

Sorry about that. What you might try is RunState.Caller.RunState.PreviousStep.

RunState.Caller gets you back to the Caller Sequence and therefore you should be able to get the Previous step. I haven't tried it as I dont have TestStand to hand but it should work.

 

Regards

Ray

Regards
Ray Farmer
0 Kudos
Message 6 of 8
(4,095 Views)

Hi Rafi,

 

Just to acknowledge Ray's answer

 

 

Juergen 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 7 of 8
(4,083 Views)
Solution
Accepted by Rafi2003

Thanks Ray and Rod,

 

It is working now!  However, I ended up using the index rather than the name  (RunState.Caller.RunState.StepIndex  and   ... PreveiousStepIndex.  By using the indexes I can tell whether the previous test has been executed and whether the running test is the first step.

 

Thanks again

Rafi

0 Kudos
Message 8 of 8
(4,056 Views)