Managing Sequence Files in an Application
- Updated2025-07-23
- 2 minute(s) read
Loading and Caching
To obtain a reference to a sequence file on disk, call the Engine.GetSequenceFileEx method. If the sequence file is already in memory, the method returns a reference to the file in the cache. If the sequence file is not already in memory, this method loads the sequence file from disk and places it in the internal sequence file cache of the TestStand Engine. Every sequence file reference you obtain from the Engine.GetSequenceFileEx method causes the cache to increment an internal usage count for the sequence file. When you are finished with the sequence file, you must call the Engine.ReleaseSequenceFileEx method to decrement the usage count. If your development environment requires you to explicitly release COM references, you must call the Engine.ReleaseSequenceFileEx method before releasing the COM reference to the sequence file.
To create a new sequence file, call the Engine.NewSequenceFile method, which adds the new sequence file to the internal sequence file cache of the engine. Therefore, before you release a sequence file you obtain from the Engine.NewSequenceFile method, you must call the Engine.ReleaseSequenceFileEx method on the sequence file. The new sequence file contains one sequence named MainSequence. You can .
You can also use the SequenceFile.AddLoadReference method to add an additional load reference to a sequence file. You must call the Engine.ReleaseSequenceFileEx method to decrement the load reference.
Structure of a Sequence File
A sequence file contains an array of sequences. Each sequence contains Setup, Main, and Cleanup step groups. To access the sequences in a sequence file, use the following methods and properties of the SequenceFile object:
- NumSequences property
- GetSequence method
- GetSequenceByName method
- GetSequenceIndex method
To access the steps in a sequence, use the following methods of the Sequence object:
- GetNumSteps method
- GetStep method
- GetStepByName method
- GetStepIndex method
Notice that all of the functions for accessing steps use a StepGroups constant to specify the step group that contains the step.
Adding New Steps and Sequences
Every step you insert into a sequence must be a unique instance. If you want to use the same step in two sequences, you must insert separate copies of the step. If you want to repeat a step in a sequence, you must insert a separate copy of the step. You can make a copy of a step by calling the PropertyObject.Clone method. Thus, you can insert a step after you create it, clone it, or remove it from a sequence. This functionality also applies to inserting sequences into sequence files.
To create a new step, call the Engine.NewStep method and then pass an adapter key name and a step type name using the AdapterKeyNames and StepTypes constants. You can then insert the new step into a sequence using the Sequence.InsertStep method. Name the new step and specify its adapter and step-type-specific properties as necessary.
To create a new sequence, call the Engine.NewSequence method and insert the new sequence into a sequence file using the SequenceFile.InsertSequenceEx method. Name the new sequence with a name that is unique among the sequences in the sequence file.
Other methods you can use to implement sequence file editing are SequenceFile.RemoveSequence, SequenceFile.DeleteSequence, SequenceFile.SequenceNameExists, Sequence.RemoveStep, Sequence.DeleteStep, and Sequence.StepNameExists.