The Status Expression field, like all other TestStand expression fields, can accept multiple expressions separated by commas. Note that if multiple expressions are used, the result of the last expression will be assigned to Step.Result.Status. Remember that Step.Result.Status is a string value—if the last expression does not evaluate to a string, an error will occur.
Let’s look at what TestStand does with the Status Expression field behind the scenes. Take the following example:
TestStand will take the contents of the Status Expression field and perform the following assignment:
Step.Result.Status = Evaluate(“Locals.x == Locals.y ? \"Passed\" : \"Failed\"”)
Notice the addition of backslashes before the inside quotation marks. Evaluate( exprString ) takes a string type input, and the backslashes (or escape characters) preceding the inside quotation marks ensure that the quotation characters are part of the string without prematurely ending it.
Test step types, such as the Pass/Fail Test, will include an un-editable Status Expression:
This is a good example of multiple expressions being used in the Status Expressions field. The first expression will set the step's PassFail property equal to its DataSource property:
Step.DataSource != "Step.Result.PassFail" ? Step.Result.PassFail = Evaluate(Step.DataSource) : False
The next expression, which is the last to be evaluated sequentially, will evaluate to a string of either “Passed” or “Failed". TestStand will internally evaluate that expression like this:
Step.Result.Status = Evaluate(“Step.Result.PassFail ? \"Passed\" : \"Failed\"”)
Note: As seen in the examples above, the conditional expression operator, ? :, is often used in the Status Expression. Take a look at the Expression Operators section of the TestStand manual for more information on this.
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.