How to Get the Names of the TestStand Sequences in C#

Updated Jun 20, 2023

Environment

Software

  • TestStand

The article outlines the steps to be able to get the name of TestStand Sequences from C#.

Perform the following steps to access the sequence names of TestStand in C#:

1. Write the following method in C#

using System;
using System.Collections.Generic;
using System.Text;
using NationalInstruments.TestStand.Interop.API;
using System.Windows.Forms;

namespace Test
{
    public class TestClass
   {
       public void TestMethod(SequenceContext thisContext)
       {
           PropertyObject pObj = thisContext.AsPropertyObject();
           seqObj = pObj.Evaluate( "RunState.Caller.RunState.Caller.Sequence" );
           SequenceName = seqObj.Evaluate( "Name" ).GetValString("", 0 );
           SequenceReqResults = seqObj.Evaluate( "RecordResults" ).GetValBoolean( "", 0 );
       }
   }
}

2. In the Sequence, call the .NET module (via DLL). 
3. Pass this.Context as input for the C# method.
4. Configure the necessary variables (SequenceName and SequenceReqResults) as Output, to be acquired from the C# method.

Same method can be used to access step names and results.