From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

vc++ dll results collection

Hi currently I have a test case implemented as a function in a VC++ DLL that returns a boolean (true if the test passes and false if the test fails). I was wondering how to use the value returned by this function to modify the "ResultsList" in TestStand.
0 Kudos
Message 1 of 5
(3,122 Views)
Hi,

Assuming you are using DLL adapter and Step Type PassFailTest.
Then providing you have returned your boolean result into the Step.Result parameter of the Step Type PassFailTest before returning from your function then Teststand will handle your returning result correctly in the ResultsList.

They are some examples sequences in the TestStand Examples folder, maybe not a PassFail Test type but the principle is the same.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 2 of 5
(3,122 Views)
Thanks for your help but there is still some points that I am not sure of. Exactly how do I pass the boolean result from my function into the Step.Result parameter? Is this done in the sequence editor or is this done in my test case code? If it is done in the code test case code how is this accomplished?
0 Kudos
Message 3 of 5
(3,122 Views)
Hi,

In you test case code, you have to perform a

TS_PropertySetValBoolean (..); with the Lockup String set to the Step.Result.PassFail ( you will need to double check the exact string name by browsing on the Step properties.).
In the Examples of TestStand is a demo sequence which returns the result to a NumericTestLimit step. The principle is the same for your code except you will use
TS_PropertySetValBoolean() instead of TS_PropertySetValNumber() which is in the example.

( I would have dropped you a small demo but I haven't got TestStand to hand at the moment)

Hope this helps
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 4 of 5
(3,122 Views)
Wisley,

To clarify, you have a VC++ DLL function that has a boolean return value. You want to use this value to set the pass/fail status of your step. Correct me if I am wrong.

You need to use the DLL Flex adapter and the Pass/Fail step type to create a step to call your function. When specifying the module for this step you will see that the default return type is void. You will need to change this to Numeric. The 2 return types supported are void and numeric. You will then need to select the numeric type that corresponds to your boolean type (my guess is that it is an unsigned 32-bit int). You will then need to enter Step.Result.PassFail in the Value Expression control.

Now when your run your function, the returned boolean will determine the value of Ste
p.Result.PassFail, which in turn is used in the Status Expression of the Pass/Fail step to determine the step status.

You may have meant that you are returning the boolean through a parameter of you function. If this is the case then you will have to set the Value Expression control for that parameter of Step.Result.PassFail and configure its type to be an unsigned 32-bit int, as described above for the return type.

Note: exported VC++ DLL functions should be enclosed by
extern "C" {}
to avoid name mangling. See the MFC examples that ship with TestStand.
0 Kudos
Message 5 of 5
(3,122 Views)