07-24-2016 10:43 PM
I have a Teststand application in which I use PostStepFailure Call Back to manage step failure. However there is a special case it will not work as I expected. If one step enable its build-in loop function and result is always fail,then when it stop from loop, Testand engine will call PostStepFailure for two times,but I just want it call one time.
For easy understanding,I make a simple example to demostrate it as following picture shows:
During executing,PostStepFailure will executed for two times not for one time!!
07-25-2016 04:52 AM
Looping a single step creates one entry in the ResultList "overhead" which represents the result of the whole loop. As your looping step fails over all iterations, all loop iterations determine as "Failed". Hence, this will call the PostStepFailure one additional time.
You can get rid of the additional call if using loop steps from the Flow Control palette.
Norbert
07-25-2016
06:31 AM
- last edited on
11-04-2024
01:58 PM
by
Content Cleaner
Hi Daniel,
I can see how the PostStepFailure callback is getting called on each failing iteration, as this is descibed in the TestStand Reference Manual - Step Execution action number #20.
If you only want to handle a failure once per step (and ignore any repeat calls to the callback for the same step), maybe one solution would be to check the step's unique ID and if it's the same as the previous call to the PostStepFailure callback you can ignore it (as it's previously been handled).
This could be done by:
1). Create a FileGlobal.PreviousStepUniqueID
2). Modify the SequenceFilePostStepFailure sequence to have the an IF..END around your usual code (or use pre-conditions) with the expression: "Parameters.Step.UniqueStepId != FileGlobals.PreviousStepUniqueID"
3). Store the current step's Unique Id at the end of your callback, using "FileGlobals.PreviousStepUniqueID = Parameters.Step.UniqueStepId"
I hope this helps,
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
07-25-2016 10:30 PM
Hi Charlie,
Thanks for your idea,it really help me!
I made a little change in checking each step unique ID since my application is complexed than example.
To avoid mistakenly matching steps from duplicated sequence by step.UniqueStepID, I append the Runstate.Caller.Step.UniqueStepID to the Step.UniqueStepID before comparing it.
So,I did it by:
Do you think this modification is a best practice or not?
07-25-2016 10:38 PM
Hi Norbert
I already guess this issue in this direction, thanks for your clarification in detail!
BR
Daniel Du