Problem
I'm trying to create an array of containers in c# to pass back to TestStand as test results, and there doesn't appear to be an easy way to accomplish this task.
Motivation
In c# I have results contained in List<Dictionary<string,object>>
from my test system and I'd like to have those results show up in my test report. The Dictionary<string,object>
has a variable number of elements of different types.
Attempted Solutions
If given:
var result = sequenceContext.AsPropertyObject().EvaluateEx(destination, EvaluationOptions.EvalOption_NoOptions);
Where
- sequenceContext is NationalInstruments.TestStand.Interop.API.SequenceContext
- destination is where I'd like my results to be saved in my TestStand report, i.e. Step.Result.TestResultDestination
I've tried a few different methods to add an array of containers to result
, such as:
var newPropertyObject = sequenceContext.Engine.NewPropertyObject(PropertyValueTypes.PropValType_Container, true, string.Empty, PropertyOptions.PropOption_InsertIfMissing);
result.SetPropertyObject("TestResultDestination", PropertyOptions.PropOption_InsertIfMissing, newPropertyObject);
result.SetFlags("TestResultDestination", PropertyOptions.PropOption_NoOptions, PropertyFlags.PropFlags_IncludeInReport | PropertyFlags.PropFlags_IsMeasurementValue);
Which adds the array of containers to my result, however any attempt to then insert an element into the array of containers results in an exception.
Thoughts?