Programmatically Disable Result Recording for Skipped Steps in Teststand

Updated Jul 24, 2019

Reported In

Software

  • TestStand

Issue Details

I want to dynamically disable result recording for steps that are skipped.

Solution

The easiest way to achieve that is to use Sequence File Callbacks. In this particular case, the SequenceFilePostResultListEntry Engine Callback can help. It is executed after each step Result container is copied to the ResultList.

In this case, the callback sequence is very simple. It is just a statement step with the following setup:

Precondition:

Paramenter.Step.Result.Status == "Skipped"

Expression:

Paramenter.DiscardResult = True

This way, after the Result was written, the precondition is checked, seeing if the step was skipped or not.
If it was skipped, the logged Results get deleted from the ResultList

Donwload the attached example and open the sequencefile with the Sequenceeditor. In order to succesfully run it, go to Edit->Sequence File Properties. In the Advanced tab under Model File, choose SequentialModel.seq and confirm with OK. Afterwards inspect and run the MainSequence with Execute->Single Pass. Notice that the skipped step is not part of the Report. 
 

Additional Information

  • Of course you can exchange the precondition to check for Failed or Passed steps.
  • Note that the Result is written during the step and deleted afterwards. For a detailed view of how this happens, cycle through the different steps using Breakpoints in the Engine Callback.
  • Disabling result recording during edit time is possible via StepSequence ,Execution or Station properties.