Adding Steps in an NI TestStand Sequence
You can add steps in an NI TestStand sequence to send values to ThingWorx, get values from ThingWorx, and execute services in ThingWorx.
1. In ThingWorx Composer, create any properties on your TestStandRemoteThing that you want to use in the sequence steps.
2. In NI TestStand, select the sequence, right-click on the step, and select Insert Step > Action.
NI TestStand screenshot
3. In the Step Settings for Action pane, on the Properties tab, select C/C++ DLL from the Adapter list.
NI TestStand screenshot
4. On the Module tab, specify the location of your NITestStandPlugin.dll file, as you did in Configure the Sequence Model File.
5. Select the appropriate function from the Function drop-down list.
NI TestStand screenshot
6. Enter the value expression for each parameter as needed.
7. Click Accept.
8. Save the updated sequence.
The following sections detail the provided functions, and their required parameters.
* 
The Locals variables are one of multiple ways to store or use values in NI TestStand. Use the method that works for your use case, being sure to match the needed data type.
To send values to ThingWorx
Three functions are provided with the NI TestStand plugin to allow sending property values to ThingWorx.
sendBooleanValue
Parameter
Data Type
Value
Example
arg1
String
The name of the thing to which you are sending a property value.
"TestStandRemoteThing"
arg2
String
The name of the property to which you are sending the value.
"PumpEnabled"
arg3
Boolean
Boolean value of sent from NI TestStand.
Locals.PumpEnabled
NI TestStand screenshot
sendNumberValue
Parameter
Data Type
Value
Example
arg1
String
The name of the thing to which you are sending a property value.
"TestStandThing"
arg2
String
The name of the property to which you are sending the value.
"PumpValue"
arg3
Double
Numeric value set from NI TestStand.
Locals.PumpValue
NI TestStand screenshot
sendStringValue
Parameter
Data Type
Value
Example
arg1
String
The name of the thing to which you are sending a property value.
"TestStandRemoteThing"
arg2
String
The name of the property to which you are sending the value.
"SerialNumber"
arg3
String
String value sent from NI TestStand.
Locals.SerialNumber
NI TestStand screenshot
To get values from ThingWorx
The following functions retrieve property values from ThingWorx, and stores them in Locals variables in NI TestStand:
getBooleanValue
Parameter
Data Type
Value
Example
Return Value
Boolean
A Locals variable to which to bind the return value.
Locals.PumpEnabled
arg1
String
The name of the thing from which you are retrieving a property value.
"TestStandRemoteThing"
arg2
String
The name of the property from which you are retrieving the value.
"PumpEnabled"
NI TestStand screenshot
getNumericValue
Parameter
Data Type
Value
Example
Return Value
Double
A Locals variable to which to bind the return value.
Locals.PumpValue
arg1
String
The name of the thing from which you are retrieving a property value.
"TestStandRemoteThing"
arg2
String
The name of the property from which you are retrieving the value.
"PumpValue"
NI TestStand screenshot
getStringValue
Parameter
Data Type
Value
Example
arg1
String
The name of the thing from which you are retrieving a property value.
"TestStandRemoteThing"
arg2
String
The name of the property from which you are retrieving the value.
"SerialNumber"
arg3
String
As strings cannot be returned to NI TestStand, this value is the location where the value is stored.
"Locals.SerialNumber"
NI TestStand screenshot
To execute services in ThingWorx
Executing services on specific things in ThingWorx is possible using the postService function. This is similar to clicking Test on a service in ThingWorx Composer.
postService
Parameter
Data Type
Value
Example
arg1
String
The name of the thing on which you are executing a service.
"TestStandRemoteThing"
arg2
String
The name of the service to execute.
"GetEventSubscriptions"
arg3
String
The payload being sent, such as a JSON payload matching the ThingWorx service input parameters, if needed.
"{\"TestName\":\"Pump1\"}"
arg4
String
The output, such as a local variable in NI TestStand where the result is stored.
Locals.JSONResult
NI TestStand screenshot
Was this helpful?