NI TestStand

Showing results for 
Search instead for 
Did you mean: 

How to generate automatically sequence files

I have to generate automatically sequence files  (using C# in dotnet) for TestStand without having to manually edit it through the editor.
The motivation for that is hundreds of existing scripts that we wish to move to TestStand. the idea is that we created custom step using .NET dlls, we already customized TestStand to use them (according the help files) and this works. now the next step is that we want to create a sequence file containing many of this custom steps, each with different values. we would like to develop a utility that will automatically do that.
But  meantime I didn't find such option, to do that in C#. Please help me to find a solution for that problem.

Message Edited by ramiyam on 09-19-2006 01:37 AM

0 Kudos
Message 1 of 13
Hi ramiyam,

It is possible to generate a sequence files programmatically. 
The best place to start would be to look at our sequence builder tool shipping example. Locate this example at <TestStand>\Examples\SequenceBuilderTool. This example acts as a tool for programmatically creating and executing new test sequences. The tool clones prewritten and configured test steps (such as your custom steps) located in a template sequence to create a new test.  The examples are for C and LabVIEW but you should be able to use the equivalent API calls in C# for those in the LabVIEW example.  Let me know if this helps.

Have a great day,

Ecleamus Ricks, Jr.
National Instruments
Applications Engineer

Message Edited by Ecleamus R on 09-19-2006 06:33 PM

0 Kudos
Message 2 of 13



but there is still problem.

Now I have the following code that builds and saves a sequence file with step:


public void CreateSquence(Engine engine)


SequenceFile sequenceFile = engine.NewSequenceFile();

Sequence sequence = engine.NewSequence();


Sequence mainSequence = sequenceFile.GetSequenceByName("MainSequence");

Step step = engine.NewStep("Sequence Adapter", "Label");

step.Name =

"Bla bla bla";

mainSequence.InsertStep(step, 0,






When I open the generated sequence its looks properly, with proper icons on each step and also if there is some "Edit" before the test execution option its runs properly.

But when i try to execute the built sequence i have the followin message:


|  Model enter point "Single passs" could not been executed                                        |

|  Error loading step 'blalbabla' on sequence 'MainSeques' in file 'z1.seq'                        |

|  Attempted to load a module for a step whose module has not yet been specified.        |

|  Error code: -17601                                                                                                  |

|  Source: 'TSAPI'                                                                                                      |


Please show me the way to solve the problem, I have spent a lot of time and have no solution.

Thank you,


0 Kudos
Message 3 of 13


You are creating a new label step using the sequence call  adapter.
Step step = engine.NewStep("Sequence Adapter", "Label");
You are getting the error because for sequence call steps you have to specify the module before executing it.
You would get the same error if you insert a sequence call step in teststand and try to execute the sequence without specifying the module.
I assume that in your example you just want to insert a Label step. Pass an empty string as the adapter name in order to use the adapter designated by the step type or, if the step ha no designated adapter, to use the default adapter.
Step step = engine.NewStep("", "Label");
For more information I would recommend you to check the TestStand Help.

Hope it helps.

Antonio Lie.

Message 4 of 13

Thank you Antonio,

it was very helpful.


0 Kudos
Message 5 of 13


I tried that also in C#, now also in CVI. But i can't get the "InsertStep" command to work. I do it in the same way as described here. It returns always an error -17337: Step type 'Label' not found in type list. I tried to leave the adapterKeyNameVal empty and the "None Adapter". Any ideas? Maybe i forgot something to include? 

0 Kudos
Message 6 of 13

Hi Thomas,


Attached is a code snippet to do what you desire. Perhaps there was a minor typo.

Attempt to run this piece of code, and let us know if you continue to have the same problem.


Note for a listing of Adapter Names and Step Types, please reference to the AdapterKeyNames and StepTypes, respectively, in the TestStand Help.


 CAObjHandle TSEngine;
 CAObjHandle SequenceFile;
 CAObjHandle MainSequence;
 CAObjHandle Step;   

 TS_NewEngine ("", &TSEngine);
 TS_EngineNewSeqFile (TSEngine, NULL, &SequenceFile);   
 TS_SeqFileGetSequenceByName (SequenceFile, NULL, "MainSequence", &MainSequence);
 TS_EngineNewStep (TSEngine, NULL, "None Adapter", "Action", &Step);
 TS_StepSetName(Step,NULL,"Bla bla bla" ) ;
 TS_SequenceInsertStep(MainSequence,NULL,Step,0,TS_StepGroup_Main) ;
 TS_SeqFileSave(SequenceFile,NULL,"C:\\newSequence.seq" );
 TS_EngineReleaseSeqFileEx (TSEngine, NULL, SequenceFile, 0, NULL);

0 Kudos
Message 7 of 13

Hi Ramiyam,


thanks for your help. But that was the way i tried already and it doesn't work. Please see the screenshot. The TS_EngineNewStep() function returns an error "Step type 'Action' not found. 




0 Kudos
Message 8 of 13

You need to load the type palette files first before the Label step will come into memory.


Use the Engine.LoadTypePaletteFilesEx method to do this.


Allen P.


Message Edited by AllenP on 09-25-2008 08:39 AM
0 Kudos
Message 9 of 13

Hi Allen,


yeah, now it works. Thanks a lot! 




0 Kudos
Message 10 of 13