02-20-2009 07:44 AM
I have a mini-application DLL which consists of some functions that run a series of tests with operator interaction. We will have the source code so I can convert it to make it TestStand compatible. The plan is to launch this mini-appliction DLL from TestStand to integrate it into a exsiting set of steps and append its results to the TestStand results report.
I have seen the tsutil.h function TS_CancelDialogIfExecutionStops that monitors TestStand and cancels the panel if the TestStand engine is terminated. This function is limited however to CVI produced applications.
My question is, is there something similar in tsutil or elsewhere that would do the same for a non CVI DLL. For example the DLL may be written MS Visual C++ with Visual C++ forms etc, that does not have a panel or called RunUserInterface().
Thanks.
02-20-2009 03:24 PM - edited 02-20-2009 03:25 PM
Hi,
In your C++, using the SequenceContext passed to your function from TestStand
void Example (LPDISPATCH seqContextDisp){
TS::SequenceContextPtr sequenceContext = seqContextDisp;
TS::ExecutionPtr execution;
TS:: PropertyObjectPtr execPropObj;
BOOL status;
execution = sequenceContext->Execution();
execPropObj = execution->InitTerminationMonitor();
etc
status = execution->GetTerminationMonitorStatus(execPropObj , [optional sequenceContextParam]); //check out the help if you need to pass this depending on your needs.
}
Check out the Programmer Reference : Using the TestStand API in different languages
Hope this helps
Regards
Ray Farmer
02-21-2009 10:57 AM
Something else to think about. Typically if the DLL is running for a long time and you called the DLL from an exectuion thread, you cannot suspend the TestStand execution until the code module returns. One option is to have the DLL instruct TestStand that it is "externally suspended" in the DLL call, so that TestStand can allow the execution to suspend. You typically do this when a dialog is being displayed or an operation is occurring that does not require TestStand while running. See the function Thread.ExternallySuspended. If you already have a mechanism to periodically check for termination, you can also check the runState output parameter of the Execution.GetStates method to see if the execution is suspended, so that you can pause the DLL operation if appropriate.
03-03-2009 07:09 AM
Additional information. The DLL will be in standard ANSI C. The TestStand the project is using is version 3.5. I assume the same princples above apply?
03-03-2009 09:33 AM
I have created a template for ANSI C calls based on your suggestions and a search of these forums.
It should handle TestStand Aborting or Termination events.
However should I do anything special to stop the TerminationMonitor if the DLL function (created in the thread) runs to its conclusion.
Thanks.
03-22-2009 12:46 PM
Hello to all
About stoping an already-running step (of DLL function) from TestStand...
What im tring to do is , call a function that 'listen' to telnet terminal & analyze/save the results , while waiting for the telnet server to reach for certain step.
This kind of function is ofcourse - blocking - in terms of the teststand -meaning the user can not stop...
1.Can you maybe sharpen your example of passing arument to DLL function via the teststand?
2.And even if i did pass that argument - will it update 'On The Fly' ??
3.
void Example (LPDISPATCH seqContextDisp){
...
}
What is LPDISPATCH?
4.Are there any examples in C# ?
5.If all above doesn't work - isn't it any way to configure theTestStand to kill all existing threads without the functions return?
Thank you very very much
DotanG