10-30-2012 06:04 AM
Hi:
I am a newer for Teststand .I am not clear for thedifference between the "RunState" and "ThisContext".
Can someone can explain it? Any help appreciated!
10-30-2012 02:43 PM
According to the TestStand help:
The RunState property object contains properties that describe the state of execution in the sequence invocation.
ThisContext- Reference to the current sequence context. You usually use this property to pass the entire sequence context as an argument to another sequence or a step module.
A sequence context is an object in the TestStand API that represents the execution state of a sequence. For each active sequence, TestStand maintains a sequence context you can use to access all the objects, variables, and properties that relate to the execution of the sequence.
The way that I understand it is that RunState is a property with subproperties and ThisContext is a reference. RunState will always contain information about the current sequence you call it from. ThisContext can be passed to other threads and updated from those threads or submodules.
Hope this helps,
01-02-2023 05:46 AM - edited 01-02-2023 06:07 AM
What is the difference between the ThisContext (Sequence Context) and the RunState? That is an excellent question. The concept of the RunState is very confusing or even mysterious. There are a couple of reasons why it isn't obvious:
The differences are:
Additional information
The Sequence Context is a reference to the run-time copy of a sequence created when initiating an Execution. The VaraiblesView control displays it as the ThisContext, and it contains the context of the sequence you see in the GUI (when editing or pausing execution). When running, it contains the context of the sequence at the place (and time) the execution pointer points.
Final thoughts
IMHO the RunState property is redundant (if we ignore TestSockets) and creates a lot of confusion. I don't know why it was added in the first place. Maybe it is there to make the execution state easily accessible during debugging? Or it could be explained with some TestStand history study? Perhaps there may have been no Auto-Completion in the expression field, and you could only drag and drop variables from the VariableView control? That could explain why TestStand designers decided to expose the Sequence Context class properties through additional top-level sub-property (even though it is a duplication and can't be read-only).
Screenshot 1
Screenshot 2
Screenshot 3