03-23-2010 08:55 AM
Hello,
from C# application, I have to use test stand API to:
1- load File sequence created with the test stand editor
2- execute sequence by passing parameters
3- get sequence results data
I found how
- loading a sequenceFile with Engine.GetSequenceFileEx() methode
- how executing the sequence with Engine.NewExecution() methode but I don't know how passing parameters to the sequence with Engine.NewExecution() methode?
- how to get back locals and parameter variables of the sequence but it seems that variables are re-initialized at the end of the sequence ?
could you help me please.
Solved! Go to Solution.
03-24-2010 01:22 AM
Hi,
You have to pass the arguments to the sequence through sequenceArgsParam which is one of the arguments to the method Engine.NewExecution . You will have to create a property object that will contain the sequences parameters and pass it to sequenceArgsParam.
To get back the locals and fileglobals in the sequence you will have to access the sequence file through the execution reference and not through the engine. Because only the execution contains the modified objects of the locals & fileglobals. My guess is Execution.ClientFile should contain the modified values.
Thanks
03-24-2010 01:38 AM
Make sure sure argument list is in the same order as that defined in your Sequence.
Regards
Ray Farmer
03-24-2010 05:46 AM
Hi
first of all, thank you for you quick response. I am gonna try this solution, indeed my problem was that I didn't use Execution object to get parameters so I could not see variables changed. In other hand I could see that exexution was still running..
Moreover, I would like to know how create an interactive sequence with the client C# application. Is it mandatory to use UI messages to communicate between the sequence process and the C# client application ?
1- if yes, when i create my sequence with the TS editor, how I can send message to the application and what is th way to synchronize sequence process and client application ?
2- if not, which are the other possibilities ?
for exemple: below there is a scenario of what I need to do.
sequence:
1- action step: call C-function of a dll. (I know to do that)=> result: 2 returns parameters, one array of unsigend char and and char.
2- action step: signal the C# application Client that theses 2 parameters are ready to be read.
3- break step: until the the C# client has read these data
transition: the C# application Client read theses parameters
4- sequence has be signaled that client has read data and continue to execute next steps....
thank a lot.
best regards.
sebastien
03-24-2010 07:39 AM
Hi,
Take a look to this Thread:
http://forums.ni.com/ni/board/message?board.id=330&message.id=17663&query.id=281482#M17663
It shows a small Dialog Example
Regards
Juergen
03-25-2010 04:17 AM
Hi,
Moreover, I would be interested to know how dynamically transfer data from sequence file to the C# client application during sequence execution?
Is UImessage class is the response to my query ?
regards
sebastien
03-26-2010 04:38 AM
03-26-2010 09:11 AM
As Juergen stated, UIMessages are the preferred way if you are writing a UI. Another way is using the TestStand synchronization step types and API (See Engine.GetSyncManager() in the API help for the API for accessing TestStand synchronization primitives). Both the TestStand synchronization step types and the sync manager API use the same underlying code so they can be used together (basically the step types use the sync manager API). Queues and Notifications can both be used for passing data (i.e. messages) synchronously between threads.
Hope this helps,
-Doug
03-26-2010 09:19 AM
Sebastien,
I'd also like to point out that TestStand has an architecture for result collection that is likely something you should be using rather than trying to do something similar from scratch. After each step in TestStand executes, it's results are added to a special local variable called ResultList. Once the execution is done running you can get the results from the Execution.ResultObject property using the TestStand PropertyObject API. See the API help for more information. If you want the results after each step rather than all at once at the end you can add a SequenceFilePostResultListEntry callback to your sequence files instead and inside of that sequence pass the result back to your UI using UImessages or you can even just call whatever code you want to call to do the processing directly.
Also if what you are really trying to do is just show the status of the execution while it's running you should be using the Trace UIMessage instead. The Trace UIMessage is sent to the UI between the execution of each step, while the UI is handling the message (i.e. before the UI calls Acknowledge on the message) the execution is in a suspected state so you can use the TestStand API to examine whatever data you wish to display.
Hope this helps,
-Doug