NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to set result of a pass/fail sequence call

Solved!
Go to solution

Hello all,

 

in my application I have a pass/fail test with the sequence adapter. The Data Source for the step is Step.Result.PassFail.

 

Is there any way to tell the caller (the pass/fail sequence call step) the result inside the sequence? I experimented with the RunState.Caller, but didn't find any property, which applies to the PassFail result.

 

Madottati

0 Kudos
Message 1 of 16
(12,623 Views)

is this maybe the right solution?

http://digital.ni.com/public.nsf/allkb/879C0008AFFC2D6A86256BC00058B482

 

But what is the use of the combination of a Pass/Fail test with the sequence adapter?

0 Kudos
Message 2 of 16
(12,619 Views)
Solution
Accepted by topic author Madottati

That link is not very helpful and, in my opinion, is not the right solution for you.

 

It doesn't make sense why you need to change the Step.Result.PassFail inside of your sequence.  It doesn't get evaluated until after the sequence has returned to the caller.  So why not just pass back a parameter and and set the parameter to Step.Result.PassFail.  I have attached an image that demonstrates this.

 

However, if it is absolutely necessary that you change it within the Pass Fail Subsequence then use this expression:

 

RunState.Caller.Step.Result.PassFail = Some boolean expression here

 

It won't evaluate at edit time but will work during execution time.

 

 

 

The reason you use the combination of Pass/Fail and sequence adapter is to create a modularized test.  Let's say that you need to call several code modules in order to come to obtain the pass/fail status.  Think of it as a function or subVI.  It just creates neat, maintainable code.

 

Hope this helps,

 

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 3 of 16
(12,607 Views)

So are you really telling me that the TestStand API doesn't expose the ability to pass an overall concept of Pass/Fail from a subsequence up to the Sequence Call step?  What is the point of being able to apply the "Pass/Fail Test" to a subsequence if there is not a concept of pass/fail to be set?

0 Kudos
Message 4 of 16
(10,923 Views)

Jeff,

 

I guess I don't follow what you are complaining about. 

 

You can have a failure on different levels.  Step failures can cause sequence failures.  The calling step will then know if the subsequence failed.  However, this doesn't apply to what is happening above. 

 

In the case above they are having the subsequence behave as a code module and the calling step controls the pass/fail criteria.  This way your report is a lot cleaner.  So if you treat the step as a Pass/Fail Test step that just happens to have the sequence adapter applied then you still need to set the Data Source somehow, because it doesn't behave like a typical sequence call step.  Different status expressions.

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 16
(10,915 Views)

First Off Jigg, I didn't mean to sound like I'm complaining.....I'm learning and I guess my style is assertive 🙂  I come from more of a Java background where the software API is very well documented and very hierarchy driven.  I mean, what could be more confusing than trying to dive down a structure like RunState.ThisContext.RunState.ThisContext.ToInfinnity.....

 

No but seriously, let me break down what I'm trying to do.

 

Say I have a Top Level Sequence File that calls any number of lower level sequence files.  If I set the steps in the Lower Level Sequence files to make them fail their respective sequences how do I then make that fail the calling step to the subsequence in the Top Level Sequence?  It would seem to me the most direct way to do that would be by making the Step that Calls the Sequence a "Pass/Fail Test"  but it seems you are advising otherwise.  So please expain to me how you can reach into a lower level sequence and access weather it has failed.

 

I even attempted to use the boolean called "SequencedFailed"...not even that had the proper result of whether the subsequence passed or failed.

 

So what is the TestStand Best Practices approach to have a higher level step fail due to a lower level called sequence?

 

Thank You

Jeff

0 Kudos
Message 6 of 16
(10,904 Views)

Complaining was probably not the best choice of words there.  I meant to say what were you confused about.  Apologies.

 

So in TestStand every step has a set of properties.  You can see these by clicking on the Properties tab in the Step Setting pane.  Then click on the Property Browser section.  Some of these properties are hidden during edit time.  You can view them by going to Configure>>Station Options and on the Preferences tab check the Show Hidden Properties box.  The thing that matters the most however is what gets put in the ResultList during execution.  Some of these properties get put in there and others don't.

 

If you pause the execution after the sequence call has executed and look in the ResultList at the entry for the sequence call you will see in the TS container that it contains the subsequence ResultList (under the SequenceCall container).  This recurses down until you are at the bottom of your call chain.  Another property of the TS.SequenceCall container is the Status.  This gets set by the engine whenever a step in the sequence fails, as long as that step has the Step Failure Causes Sequence Failure flag set.  So basically after every step executes the engine looks at its status and sets that flag when it returns to the caller.  Well that status gets passed up to the callers until it reaches  MainSequence.  Again, as long as that flag is set for all steps, including the sequence calls.  When MainSequence returns to the process model then the process model has that setting in the resultlist and knows how to handle it during the report generation stage.

 

Either way you call a subsequence (Pass/Fail or Sequence Call) the call chain will contain step status as Failed.  Why?  Because in the Pass/Fail scenario the Status is set by the Status Expression of the step.  In the Sequence Call scenario the Status is set by a subsequence step failing and passing it back up.  Personally, I like the Pass/Fail scenario because it gives you more control.  To be honest I use the Multi Numeric Limit one a lot more.  This way the subsequence just acts like a VI or .NET method.  You don't expect it to calculate the pass fail information.  You can calculate it at the higher level.  You can then call the subsequence without doing any pass/fail if you'd like and it acts like an Action step.  Makes the code more modular and gives you more code reuse ability.

 

There are a thousand ways in TestStand to accomplish the goal.  It all comes down to what you feel is the best for you.

 

Hope this helps,

 

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 7 of 16
(10,894 Views)

Jigg,

 

Wow, I couldn't even wait to dive back into this before taking the time to say thanks.  Very detailed and informative response (better than I have ever gotten from opening an NI Support Ticket)

 

 

I think I have found a new home in the forums.

 

After hours of banging my head against this in the afternoon I'm suddenly motivated to take another crack at it with your advice.

 

Thank You

Jeff

0 Kudos
Message 8 of 16
(10,871 Views)

It's me again.  So usually I'm a pretty quick learner on this type of stuff.  Somehow I'm still struggeling here.

 

I wrote a super simple example.  One sequence that has a single Pass/Fail Test calling a sub sequence.  And all the subsequence does is set the Step.Result.PassFail = True in a post expression.

 

Running it shows the sub sequence pass and yet somehow the top level sequence reports that step as a fail.

 

Looking at the "Satus Expressions" in the ResultList of the top level shows tha the subsequence reported "Passed" while the top level has its Status = "Failed".

 

I attatched the three files needed to run this.

 

Help is appreciated.

 

Thanks

Jeff

Download All
0 Kudos
Message 9 of 16
(10,839 Views)

Here's what I see in your code.  In TopLevel.seq MainSequence you have a Call Sub Sequence that is a Pass/Fail Test.  It will ALWAYS fail because you are not setting the Step.Result.PassFail property anywhere and it is defaulted to False, which is a fail. 

 

In the LowerLevel.seq MainSequence you have a Pass/Fail Test LabVIEW adapter step.  Typically it should always fail the way you have it set up.  However, as you said the Post-Expression will set it to pass.  So even though it is passing the caller (TopLevel.seq) is failing because of my explanation above.

 

If you truly want this to act like I described earlier then check out the modified files.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Download All
0 Kudos
Message 10 of 16
(10,831 Views)