NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Different ways to start a run?

Solved!
Go to solution

We have written a C-Sharp application that is a GUI wrapper around TestStand to hand-hold the operator through setup and execution of a test. I have noticed the following behavior differences with each of the different ways to start a sequence file running:


a) When we useSequenceFileViewMgr.Run() to start the execution, TestStand does not prompt for a UUT serial number and it does not generate a DisplayReport event.


b) When we use SequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_ExecutionEntryPoints_Set).Execute(true) to start the execution, TestStand does prompt for a UUT serial number and it does generate a DisplayReport event.


c) When we useSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_ExecutionEntryPoints_Set, 1).Execute(true) to start the execution, TestStand does not prompt for a UUT serial number and it does generate a DisplayReport event.


Are there other ways (better ways) to start an execution from a C-sharp application?


Behavior "C" is the behavior I am looking for, but I would like to understand why the calls have different results?


Can someone enlighten me?

0 Kudos
Message 1 of 10
(5,672 Views)
Solution
Accepted by tlaford

tlaford,

 

What you're essentially doing is running different execution entry points.  If you look at the execute menu in the sequence editor, you will see three options (with the default process model, if you have a custom process model, you may have a different number).

  1. Test UUTs
  2. Single Pass
  3. Run <Name of current sequence>

When you call .Run() you're doing the same operation as Run <sequence name> from the menu.  This runs just the currently selected sequence and nothing else.  Great for debugging, but does not use the process model framework.

 

When you use one of the ExecutionEntryPoints, you are running one of the execution entry points from the process model.  Those generally call into the MainSequence sequence of your client sequence file.  And they perform other operations (such as gathering UUT data, and reporting) around the execution of your client file.  The default process models have TestUUTs as index 0 and SinglePass as index 1.

 

Using the SequenceFileViewMgr is the best way to start a new execution from a user interface programmatically.

 

Hope this helps.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 2 of 10
(5,668 Views)

Thank you Josh.  So by specifying a "1" as the second argument in the call means to run a SinglePass, and a single pass doesn't prompt for the UUT serial Number?

 

What variable stores the UUT serial number when the operator is prompted?

0 Kudos
Message 3 of 10
(5,661 Views)

Using the TestStand Sequence Editor, you can easily search for variables like this.

The only thing you have to know (and take care of): not all variables do exist during editing time. Those are called "Runstate Properties" and like the name suggest, exist only during runtime.

The serialnumber is an example for a runstate property. The lookup string would be

RunState.Root.Locals.UUT.SerialNumber

 

hope this helps,

Norbert

 

[EDIT] Please note that some data (like the serialnumber) is stored in different locations due to call stack/other mechanics. So it depends on the "time when you want to access the data". The quoted lookup string is valid for the client sequence which is currently in execution using a NI process model.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 10
(5,657 Views)

to add to Norbert's response:

 

Only when you run via Test UUTs will RunState.Root.Locals.UUT.SerialNumber contain anything valid. With Single Pass and Run <sequence> it will be an empty string.

 

Regards

Ray Farmer

Regards
Ray Farmer
Message 5 of 10
(5,646 Views)

If I start an execution with the following code:

 

SequenceContext sc = e.thrd.GetSequenceContext(0, out frameID);
sc.AsPropertyObject().SetValString(
"RunState.Root.Locals.UUT.SerialNumber",
PropertyOptions.PropOption_InsertIfMissing,
mySerialNumber); SequenceFileViewMgr.GetCommand(
CommandKinds.CommandKind_ExecutionEntryPoints_Set, 0).Execute(true);

 

Is there any way to suppress the dialog that pops up asking for a UUT number?

0 Kudos
Message 6 of 10
(5,539 Views)

You are using a process model to run the execution. The process model is good since it handles stuff like the serial number and reporting.

But the process model also creates the pop up dialog asking for the serial number.

 

I suggest you to learn about TestStand process models and about model callback overrides.

 

That being said, you need to override your "Pre UUT" callback from the model. I additionally suggest you to remove the SetValString function in your UI code and replace this with the following setup:

Your modified Pre UUT (override) sends a custom UI message asking the UI for the serialnumber.

The UI catches the custom UI message and sets the serial number in the sequence context as needed.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 10
(5,526 Views)

The code you are showing creates a new execution that runs a Test UUTs loop. Setting the serial number in your current execution will have no effect on the new execution. What exactly are you trying to do?

 

-Doug

0 Kudos
Message 8 of 10
(5,519 Views)

I am trying to initiate a test execution from within my C sharp application without the SerialNumber dialog popping up.

0 Kudos
Message 9 of 10
(5,515 Views)

I recommend either overriding the PreUUT and PostUUT callbacks or modifying the process model. To get the serial number from your UI or C# application that's acting like a UI in the PreUUT callback, you can post a custom UIMessage synchronously (synchronous parameter should be true to Thread.PostUIMessage). Then in your UI when you get the custom UIMessage you can either use the sequence context of the thread for the UIMessage to update the variable directly, or your PostUIMessage call can pass the serialnumber variable as the activeXdata parameter to the UIMessage and you can get and set it from that in your UI.

 

Hope this helps,

-Doug

0 Kudos
Message 10 of 10
(5,505 Views)