From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing failed step name to a VI

How can I pass the name of the first failed test from Teststand to a LabVIEW VI?  I only want to pass the name of the specific test that failed, even if that test is in a sub-sequence (I do not want to pass the name of the failed sequence, just the failed test).

0 Kudos
Message 1 of 14
(5,101 Views)

Apparently it can be done because somehow they do it in the failure chain on the report.  So it'd be doable but probably won't be trivial.

 

What exactly is the purpose for this?  There may be a better way to accomplish what you want.  i.e. using the SequenceFilePostStepFailure engine callback might be the better way to go.

 

A couple things to think about:

At what point do you need to access it?  Because the default settings in TestStand allow the first step that fails to automagically jump to the Cleanup.  This will be tricky if you need to access it before that.  Or if you change the default setting dynamically to not do this then you will have to create an algorithm to traverse through the ResultList to find the first failed step.  That could get really messy because you won't know the depth of sequence calls. 

 

Your best bet is to set a flag in the SequenceFilePostStepFailure on the first step that fails.  Then on every other step just ignore setting that variable.  I've attached a simple example in TS 4.1.1.  You will see the FileGlobals.FirstFailedStep as a string which gets set in the callback.  This can then be passed to the VI.

 

I don't guarantee my algorithm for the FirstFailFlag.  I didn't prove it out.

 

Hopefully this helps!

 

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

My customer uses a command line based database reporting program that is used to collect statistics about the UUTs on a manufacturing line.  They want to know when a UUT passes and fails, and in the case of a failure, to know on which step the UUT failed (just the first step failure, not all of them).

 

I generate a more detailed Teststand XML report for them, but also have to use a command line interface to give the high level reports for their statistical QA system.  I interface with the command prompt using a LabVIEW VI.

 

The test involves hundreds of steps in several sub-sequences.  I modified your sequence to put some steps inside a sub-sequence.  Unfortunately, if the first failure is in a sub-sequence, it only reports on the name of the sub-sequence and not the lower-level step.  I think that this is a good start, however.

0 Kudos
Message 3 of 14
(5,070 Views)

Interesting....It worked for me with a subsequence.  I wonder what you could be doing differently.  Here's what I did.

 

I even changed to sequence call step type to be Pass/Fail and set the data source to False.

 

HMMMM.....?

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

Hi,

 

I wish to do something similar to this post so I replied here instead of starting a new post.

 

I want to find out what the first failure is, as it would be shown in the report file. So I would need a precondition on the above SequenceFilePostStepFailure to only log the failed step if the failed step calling this has Result Recording Enabled.

 

So is it possible to check if the previous step has result recording enabled while in the SequenceFilePostStepFailure?

 

Thanks,

Dave

0 Kudos
Message 5 of 14
(4,813 Views)

It won't show up in the dynamic API but you can use Parameters.Step.RecordResult.  If that is True then the step is set to record results.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 14
(4,805 Views)

Excellent, thanks for your help, that has worked perfectly

0 Kudos
Message 7 of 14
(4,777 Views)
Strictly terminology of previous step : have you tried runstate.caller.runstate.previousstep ?
Then you can check for different runstate variables etc.
You may need to bullet proof this a touch though if the step you're on is the first one in the sequence (runstate.caller) and decide to go back up again (runstate.callet.runstate.caller.runstate.previousstep) or to just not bother going up again.

The other interpretation of 'previous step' is the step that actually failed which is the one passed in via the parameters.step which only populates when running. Put a none adapter action step down in the callback sequence where you need to be doing something with the values and then put a breakpoint on that step. Then you can look at the variables tab and see what you have access to at that point in time. Sometimes you need to show hidden items (configure station options and then preferences). Once you've found the item, you can copy it (right click) to copy the path or the value inside that item. Then when you get back to edit mode, that item is on the clipboard and you can continue editing and developing what to do with that item.

Thanks
Sacha
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 8 of 14
(4,766 Views)

My problem is very similar to what is mentioned here. I have found name of the failed step but my sequence has a for loop and it only works first time.

How do I change my sequence file(attached) to display failed step during every iteration of for loop.

Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 9 of 14
(4,520 Views)

Hi,

 

What you can do is to create a PostStepFailure callback either for SequenceFile (it will work just for steps grouped by this file) or for ProcessModel (it will be called for each step ran from it). Such callback is triggered every time a test step fails.

 

Best Regards,

------------------------------------------
CLA, CTD, CLED @ Test & Measurements Solutions Poland
Message 10 of 14
(4,509 Views)