NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Change step result status from a string to an integer

Hello Community,

 

I am using TestStand 2024 Q4 64-bit and a SQL Database.

 

In my database I have the following tables:

1. StepResult table with 3 fields called StepResultId, StepName, and StatusId

2. Status table with 2 fields called StatusId and StatusName

 

In TestStand the step.result.status property is a string value with the following options "Done", "Skipped", "Passed", "Failed", and "Error".

 

How can I update these values to be integers in TestStand for logging to the database?

 

Example:

Status Table                                StepResult Table

StatusId StatusName                  StepResultId         StepName         StatusId

1            Passed                          1001                     MyTestStep1      1

2            Failed                            1002                     MyTestStep2      1

3            Error                              1003                     MyTestStep3      2

4            Done

5            Skipped

 

Thank you!

0 Kudos
Message 1 of 4
(169 Views)

IMHO, having the Status as a name has been one of the fundamental design decisions.

Trying to change something here might be challenging/ painful.

 

In theory, you could  go and have your own typedefs, which feature an interger field in the respective result container, modify the StatusExpression to set values. I' not sure, if you have to modify the Database Schema to actually push this to the DB.

 

If you need this integer information for data evaluation, you might want to consider adding a "translation" table to your DB and use a JOIN for your SELECT to "replace" the string-based status with an interger based one.

 

Might be less painful and easier to mainain in the future.

0 Kudos
Message 2 of 4
(144 Views)

I know it may be difficult, but I had to at least ask for my own curiosity. For a report it is nice to see "Passed" or "Failed", but when logging to a database it is more efficient to store an integer. My test could have many steps and recording "Passed" as a string for each record adds up in bytes. Is there a place I could add a select case to test if the result is passed, then use a statement to record the integer in a ResultList, and then somehow log the new ResultList?

0 Kudos
Message 3 of 4
(132 Views)

In order to achieve this, you could overwrite the SequenceFilePostResultListEntry to add your custom data using the TestStand API

 

Yet, if you want to save data base storage, you need to exclude the standard string via custom schema.

0 Kudos
Message 4 of 4
(127 Views)