05-28-2019 08:44 AM - edited 05-28-2019 09:02 AM
I am running the example sequence Computer Motherboard Test Sequence that comes with TestStand in a C# application using the TestStand API. I am trying to get a report out of it. If I run the MainSequence with no process model, everything seems to run okay. If I add in a process model, WaitForEndEx() returns right away and I don't see any popup from the sequence itself. I added a 5 second wait and a few message popups to the sequence and none of these appear to run. The ExecutionRunStates value shows that execution has stopped as well. My code is as follows:
Engine eng = new Engine(); User admin = eng.GetUser("administrator"); eng.CurrentUser = admin; StationOptions stationOptions = eng.StationOptions; stationOptions.DisableResults = false; stationOptions.AllowOtherModels = true; SequenceFile seqFile = eng.GetSequenceFileEx(seqName); SequenceFile modFile = eng.GetSequenceFileEx("C:\\Program Files\\National Instruments\\TestStand 2017\\Components\\Models\\TestStandModels\\SequentialModel.seq"); Execution exec = eng.NewExecution(seqFile, "MainSequence", modFile, false, 0); exec.WaitForEndEx(-1);
exec.GetStates(out ExecutionRunStates runState, out ExecutionTerminationStates termState); MessageBox.Show(runState.ToString()); MessageBox.Show(termState.ToString());
exec.Report.Save("report.xml", false, 0);
eng.ReleaseSequenceFileEx(seqFile); eng.ReleaseSequenceFileEx(modFile);
In the NewExecution() call, if I replace modFile with null, it runs as expected. If I change "MainSequence" to "Test UUTs" or "Single Pass", the code ends up stuck in WaitForEndEx(). I plan to focus on this more after I get "MainSequence" working correctly with a process model, but I figured I might as well bring it up in case anyone knows the solution to that.
Solved! Go to Solution.
05-28-2019 12:03 PM
I may be wrong but it feels like you need to pass "Test UUTs" or "Single Pass" as your sequenceNameParam if you are using a model. This is from the TestStand help:
sequenceNameParam As String
[In] Specifies the name of the sequence or Process Model entry point to execute.
Hope this helps,
05-28-2019 02:08 PM
I was under the impression that I could do all three for the sequenceNameParam. If I use "Test UUTs" or "Single Pass" though, the application is forever in the WaitForEndEx(-1) call, so I must be missing something for those sequenceNameParam values as well.
05-28-2019 04:57 PM
to be honest I've never really called a sequence file like this without a user interface or from an existing execution. By user interface, I mean an executable that has an application manager.
Not sure if you know this but you can pass parameters to the shipping UIs and have it run silently. https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P9lvSAC
Generally I do this if I need to run a sequence file dynamically.
05-29-2019 07:51 AM - edited 05-29-2019 07:53 AM
Thanks for pointing me to that. That may be the route I need to go if I can get it working that way. Currently I'm trying to figure out how to get around the login screen and have it run silently.
05-29-2019 11:37 AM
The way around the login dialog is to use a front end callback that simply sets the user to an administrator or operator.
05-29-2019 04:07 PM
I got it figured out. I should be using the "Single Pass" entry point and I had some non-standard results processing options set from going through the NI training on TestStand. I am now able to get the report and can use a process model.