NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Which parameter must I modify to force a step to fail

The Step.Result.PassFail is unknown, although it exists in the "Test Data" cluster. Assigning a value to Step.Result.Status in a post expression has no effect.
0 Kudos
Message 1 of 11
(4,205 Views)
Hi,

For any step, you can set the run mode as always pass/fail.
You can view the run mode by right clicking the corresponding step.

SAS
0 Kudos
Message 2 of 11
(4,205 Views)
Well, actually I want to be able to force a fail programmatically, if an instrument returns an errorcode.
I have a "Numeric Limit Test Step" which performs a High voltage test on a mains connector. If the connector is shorted, the instruments will return an errorcode for "shortcircuit" but the measurement readout is still inside limits. I therefore check the errorcode and set the Pass/Fail parameter accordingly in the Test Data cluster.
Unfortunately TestStand ignores this parameter and only checks that the measurement is inside limits.
Are there any workarounds to this problem.

Regards Poul Anker
0 Kudos
Message 3 of 11
(4,205 Views)
Well, i am not sure of how to make the test fail. But, you can pass the step error to user created error control and check the error status, to assign the data source for your numeric limit test,
ex;
Locals.MyError.Occurred?value to fail the test:realData

Regards
0 Kudos
Message 4 of 11
(4,205 Views)
Poul -
You are correct that the Numeric Limit step does ignore any previous value in Result.Status, so if you set it in a post expression, it will be ignored when evaluating the status expression.

One option is to add another Pass/Fail step after the Numeric Limit to test the short condition.

If you do not need the measurement when a short condition occurs, you could store the short condition and the measurement in local variables and use the Data Source expression to be something like:
"(Locals.ShortOccurred)? -1: Locals.MeasurementValue" assuming that a "measurement value" of -1 would cause the limit test to fail.

Scott Richardson (NI)
Scott Richardson
0 Kudos
Message 5 of 11
(4,206 Views)
Scott,

In the meantime I have made an extra PassFail step that checks for locals.ErrorOccurred in its post expression and fails the test if it is true.
However, your suggestion of passing a negative number to measurement is more simple and elegant, as this will force the actual step to fail (since measurement must be >= 0). Normally I prefer not to tamper with the measurement value, but in this case it is ok since the readout of the instrument is not valid anyway.

Thanks for the advice.

Regards

Poul Anker
0 Kudos
Message 6 of 11
(4,205 Views)
Hi,
I am trying to do something similar to this. I have a DLL which returns and error code and msg through the TestError datatype. When I have an error to that particular step, I would like the sequence to fail. I don't want the actual step to fail since I would loose the error message in the report. Is there a way to do this without adding the extra step, to keep the sequence as clean as possible?

Thanks!

Louis
0 Kudos
Message 7 of 11
(4,107 Views)
Hi Louis,

First, to have the sequence fail in the case of an error in "yourstep", you’ll want to set RunState.SequenceFailed.Value = True. You could use a statement step following "yourstep" to set this value appropriately with an expression like:

RunState.Sequence.Main["yourstep"].Result.Error.Code!=0?(RunState.SequenceFailed.Value=True) : (RunState.SequenceFailed.Value=False)

Of course, your condition may be different. If you wanted this to be done in the step, I recommend making a custom step type and editing the default status expression to include an expression like:

Step.Result.Error.Code!=0?(RunState.SequenceFailed.Value=True) : (RunState.SequenceFailed.Value=False)

Regards,

Eric M

Message Edited by Eric M on 05-31-2005 05:04 PM

0 Kudos
Message 8 of 11
(4,082 Views)
Is this code meant for TS 3.1? When changing the default status expression TestStand says it has an error, expecting string, found boolean.
0 Kudos
Message 9 of 11
(4,063 Views)
The status expression should return a string.

An example of this would be
Step.Result.Error.Occurred? "Failed": "Passed".

You could also alter the "Passed" part to be another expression that determines if the stpe passes or fails based on other conditions.

Allen P.
NI
0 Kudos
Message 10 of 11
(4,049 Views)