Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 ratings:
 5 out of 5     Rate this Document

Modify the Pass/Fail condition of a TestStand Pass/Fail Step with a Custom Expression

Primary Software: TestStand
Primary Software Version: 4.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I have a code module that returns multiple values and I want my TestStand step to pass or fail based on a condition that is a combination of these values.

How can I modify my step to do this?



Solution:
If you are using a TestStand Pass/Fail Test Step, you have two options that will allow you to set your pass/fail conditions based on a custom expression containing multiple values.

Modify the Data Source:

  1. In the Step Settings panel, go to the Data Source tab.
  2. Replace Step.Result.PassFail with your custom condition. You can use the Expression Browser dialog to help you construct the condition.
  3. Click the Check Expression for Errors button to verify that your expression is syntactically correct.

The reason this works is because the pass/fail status for this step type is determined by the Status Expression:
Step.DataSource != "Step.Result.PassFail" ? Step.Result.PassFail = Evaluate(Step.DataSource) : False, Step.Result.PassFail ? "Passed" : "Failed"

What this means is that if the Data Source is not the string "Step.Result.PassFail", it will set the boolean Step.Result.PassFail to the result of whatever we entered as the Data Source. You can get to this by going to the Properties tab in the Step Settings panel and clicking on Expressions.

Modify Step.Result.PassFail in the Post-Expression:

  1. In the Step Settings panel, go to the Properties tab.
  2. Click on Expressions on the left group box.
  3. Assign custom expression to Step.Result.PassFail in the Post-Expression textbox. You can use the Expression Browser dialog to help you construct the condition.
  4. Click the Check Expression for Errors button to verify that your expression is syntactically correct.

Note: If your code module returns values that you want to be part of your Pass/Fail condition, you must assign them to a variable in TestStand first in the Module tab.



Related Links:

Attachments:





Report Date: 02/16/2008
Last Updated: 03/07/2008
Document ID: 4IFANAPE

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit