NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if there was a failed step before?

Solved!
Go to solution
Hello,
i have a sequence with some subsequences. How can i check in for example sequence 4 if there was somewhere before a failed teststep?
I found the variable "RunState.SequenceFailed" but this is only for the current sequence. Is there the same available for the complete sequence?
 
Thanks for your help
0 Kudos
Message 1 of 8
(5,895 Views)
Hi,
 
I dont really understand your question but from the message subject heading, you would use RunState.PreviousStep.Result.Status to check whether the previous step failed.
 
If a step failed within the sequence, then providing that step has the setting to make the sequence fail enabled, when the sequence returns to the caller, it will generate a failure of the step just called (if that makes sense).
 
regards
Ray Farmer
 
Regards
Ray Farmer
Message 2 of 8
(5,886 Views)
I try to explain it more detail:

This is my sequence:
Mainsequence with some subsequences
subsequence_1
subsequence_2
subsequence_3
subsequence_4

Now in the subsequence_2 is a teststep which is fail.
What i want to do is to create a precondition for a teststep which is in subsequence_4 which only executes the step if there was a fail before. Not in the previous-step but in any of the steps which where execute in subsequence1 to 4.
0 Kudos
Message 3 of 8
(5,864 Views)

Hello All,

 

I also came across same requirement.

I have a sequence with bunch of steps (50+) and in the second last step, I would like to know if any of the previous steps (including sequence calls) has "Failed" status associated.

 

Is there a TS property, I can use for this?

 

Thank you and have a nice day.

0 Kudos
Message 4 of 8
(3,639 Views)
Solution
Accepted by NI_Community_Support

How about checking results list? You can do it in single step with looping enabled.

 

You could also use engine callback for fails. Each time you have a fail, this callback is called. In this callback you can set some global flag.

 

Try also RunState.SequenceFailed property. I'm not sure if this will work in your case, though.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
Message 5 of 8
(3,627 Views)

Hello Michał,

 

Thank you for the reply.

While looking for a way 'to check if there was a failed step before', I came across 'checking results list'.

This could be my prefer way, although I'm not sure how can I take this dynamic array (Locals.ResultList) and search for a "Failed" status element.

 

Can this be done using a TestStand 'Expression' step?

 

Edit-1: Second approach that you mentioned, using engine callback, unfortunately, I couldn't find much info regarding that.

Used 'SequenceFilePostStepFailure' and it works just fine.

 

Thank you again for your reply.

 

Edit-2: Unfortunately, I cannot mark it as solved.

0 Kudos
Message 6 of 8
(3,609 Views)

You will always have Locals.ResultList. So, you can use Statement with expression like Locals.ResultList[Locals.Index].Status (where you iterate using Local.Index; this loop can have different forms) to see how many fails you have. This way you will see only fails for the "shallow" CallStackDepth - no matter how many fails you have in the subsequence, all of them will be counted as one. To count every individual fail using ResultList you would need to create some recurrent method. For this approach, I will recommend using LabVIEW. Subsequence results can be accessed using Locals.ResultList[Locals.IndexA].TS.SequenceCall.ResultList[Locals.IndexB].Status (you can go deeper and deeper this way).

 

The engine callback approach does not need recurrence and seems easier.

 

I don't have LabVIEW nor TestStand at my disposal at the moment so I can't provide you working example.

 

Is my description understandable? Which part still needs to be explained in order to close the topic?

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
Message 7 of 8
(3,603 Views)

Hi Michał,

 

Your 'Engine Callback' suggestion was a perfect solution for my requirement.

I mentioned that I cannot close (or mark as solution) because I'm not OP for this thread. I would request moderator to mark it as Close/Solved.

 

Kind regards.

 

Message 8 of 8
(3,593 Views)