NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I detect that a step was forced to fail or forced to pass?

Solved!
Go to solution
When I set one step to ForceFail, and another step to ForcePass, and I run the test sequence, the ResultStatus is just "Failed" or "Passed" without providing any feedback that it was not a true test.  Is there a way to detect / document this?
0 Kudos
Message 1 of 19
(4,694 Views)

Let me provide a little more detail: We have written a C#application which is a GUI wrapper around TestStand to hand hold the user through the selection of a test, installation of the proper equipment on the testing hardware, execution of the test, and generating reports.

 

When looking at the report data that TestStand provides (in the End Execution Event), it reports "Failed" for both a true failure and a ForceFail, and it reports "Passed" for both a true pass and a ForcePass.

 

Is there a way to detect the forced status?

0 Kudos
Message 2 of 19
(4,689 Views)
You could use a PostStep callback which would modify Step.ResultStatus if the step is step or Force Pass or Force Fail. There is no existing option that I know of which will accomplish this.
0 Kudos
Message 3 of 19
(4,686 Views)
Could you post some psuedo code to show what you're suggesting?
0 Kudos
Message 4 of 19
(4,684 Views)

I'll do you one better, here's a working example. It uses the SequenceFilePostResultListEntry callback, but you could also implement it in process model using ProcessModelPostResultListEntry. You may have to modify your stylesheet to get results to populate correctly, particularly with XML or ATML reporting.

 

It's pretty simple: if the reporting step uses either Force Pass or Force Fail, the callback updates both the UI's ResultStatus and the Result.Status going into the report. If you only want one or the other, remove or comment out the part you don't want.

Message 5 of 19
(4,680 Views)

Thanks.

 

However, I'm using TestStand 4.0.1 and can not open your TestStand 4.2 file.

 

I assume I can use your SEQ file as a template to modify my C# code to handle this event.

0 Kudos
Message 6 of 19
(4,671 Views)
Back-saved. Not sure how this would translate to C# code; you could just as easily get a reference to a sequence and loop through each step and call GetRunModeEx() on it.
0 Kudos
Message 7 of 19
(4,668 Views)
My first idea was to use the ExecutionViewMgr's Trace Event with code something like this
private void axExecutionViewMgr_Trace(object sender, _ExecutionViewMgrEvents_TraceEvent ev)
{
string runMode = ev.ctxt.PreviousStep.GetRunModeEx(System.Type.Missing);
if (runMode == RunModes.RunMode_ForceFail)
ev.ctxt.PreviousStep.ResultStatus = "ForcedFail";
else if (runMode == RunModes.RunMode_ForcePass)
ev.ctxt.PreviousStep.ResultStatus = "ForcedPass";
}
But ev.ctxt.PreviousStep is a ReadOnly property, and I can not change its ResultStatus.  So I was looking for a different event that would get raised at the end of every step and would allow my event handler method to manipulate the ResultStatus property.
0 Kudos
Message 8 of 19
(4,645 Views)
Approaching the issue from the opposite direction:  Is there a way to tell TestStand to flag a ForcePass/ForceFail with a different ResultStatus string, or some other way that can be used when parsing the "ResultList" in an EndExecution event handler?
0 Kudos
Message 9 of 19
(4,627 Views)

tlaford wrote:
Approaching the issue from the opposite direction:  Is there a way to tell TestStand to flag a ForcePass/ForceFail with a different ResultStatus string, or some other way that can be used when parsing the "ResultList" in an EndExecution event handler?

Yes, that's precisely what the callback I posted does. Did you look at it and see if it does what you're looking for?

0 Kudos
Message 10 of 19
(4,624 Views)