NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Post Expression Execution...

If I set a steps Run Mode to Force Pass, will the Pre and Post Expressions get executed? It appears that they do not.

If an error occurs in a step, and ignore is selected from the Error dialog box, does the Post Expression get executed? It appears that is does not.
0 Kudos
Message 1 of 5
(4,964 Views)
Hi Capt.,
Although it's not stated explicitely, if you have a look at the user manual - pages 5-17 and 6-26, it says that if you set the Run Mode to Force Pass, the whole of the step is not executed - this is then backed up by the table on pages 6-25 to 6-26, where the Run Mode is checked at action 5, before the pre-expressions are executed. (but after the pre-conditions and the step lock and batch synchronisation actions - can NI comment on when the lock is released in this case, or where the step resumes - I assume with action 17 - post step engine callback so looping can continue, or with action 29 to release the step lock????)

If Ignore is selected on the Error Dialog, the damage is already done (depending on when the error occurred of course) - on pag
e 6-29 it says that "When a step causes a run-time error, the step stops executing", i.e. immediately. On page 6-30, it says that if Ignore is selected "...TestStand resets the Error.Occurred property of the step to False and execution continues normally with the next step in the sequence." i.e. depending on where the error occurs, ignore effectively skips over the rest of the step, and starts on the next one (that's supposed to execute according to RunState.NextStepIndex - be careful if an error occurs that means the PostAction doesn't get to select an appropriate next step - if you're worried about this, you can check the Runstate.PreviousStepIndex to check that you got to the step from the appropriate place)

Hope that helps

S.
// it takes almost no time to rate an answer Smiley Wink
Message 2 of 5
(4,964 Views)
Thanks, this is what I needed to hear - I figured that this was the true for both cases, but it was implied and not explicitly stated, and it can be hard to check out some of the potential possibilities for results in simulation.

It would be nice if NI updated table 6-5 on 6-25 & 26 to comment more on the conditions involved in each step, and where things jump to if the conditions are not met.
0 Kudos
Message 3 of 5
(4,964 Views)
Hello -

To clarify for both you and SashaE...

"can NI comment on when the lock is released in this case, or where the step resumes - I assume with action 17 - post step engine callback so looping can continue, or with action 29 to release the step lock????)"

I ran a few quick tests to see what happened in the case of an ignored error and here was what I saw with TS 2.0.1f1. In general, If you are using the step property to lock a step, the lock is always initialized on "step 2" of table 6-5. The reasoning behind this is strictly to do with thread-safety for all the execution&results. If you are looping on the step (again via step properties) the assumption is, that you do not want to lock&unlock for each iteration of the loop, you are already in
a single-threaded state, you simply want to call your module again. For every run of your loop, you will bounce between steps 8 and 21 until your "while" condition evaluates to false, then it will jump to 22 and continue with the wrap-up on the step. Again, for thread-safety reasons, the unlock is one of the last things you do before moving on to the next step in your sequence.

In the case of an error received in the pre-expression or code-module, the order of events will basically resume at step 16. If you are in a loop, the particular loop cycle will have a status of "Error" while the loop as a whole will see the status of "Failed". Your engine callbacks and post actions will still occur. I tried my sequence with the callbacks on PostStepError and PostStepFailure as well as PostResultListEntry. I also altered my Post Action expression to handle the case of if the step's status was "Error" to good result. In all cases, locks and synchronization sections will be discarded so that ot
her executions will have their chance to execute the step.

Regards,

Elaine R.
National Instruments
http://www.ni.com/ask
0 Kudos
Message 4 of 5
(4,964 Views)
Thanks Elaine - just the information we needed.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 5 of 5
(4,964 Views)