NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Interaction with running executable

Dear Teststand-Expert,

 

I am currently struggling with the following issue and would appreciate any available help 🙂

 

My Testsetup requires an executable to run. It is started once and used to interact with python-scripts which are called by teststand during the whole procedure of testing.

 

I am able to start the executable and since I want it to keep running I use "No wait" as a wait condition.

When finished with all tests I use C/C++ DLL call to Kernel32.dll to Terminate it's process and close the handle. This seems to work.

 

But what I need after starting the exe is a possibility to read the print of the console of that executable. This application loads a driver to external hardware which does only just write an error message to the console if loading failed. Since I want to skip all tests if the driver could not load, I need a possibility to read this print back before continuing.

 

When I set wait Condition to "wait for exit" I do get the message that I want but of course I want to read this message while the executable is still running...

Is there any way to pipe the command window print to teststand so that I can parse those outputs?

 

Thanks for all your comments 🙂

mb86

0 Kudos
Message 1 of 4
(1,011 Views)

Do you own the executable source?  Update the source to use TestStand SyncManger Queue, then in your sequence DeQueue the information you want. 

 

If you don't own the source, create a Wrapper assembly, that will launch the existing exe and return any messages.  Now update your sequence to call the wrapper assembly and get the response.

0 Kudos
Message 2 of 4
(938 Views)

Maybe try to redirect the stdout/stderr into a temporary file and read it from TestStand?

 

https://support.microsoft.com/en-gb/help/110930/redirecting-error-messages-from-command-prompt-stder...

Mateusz Owczarek

Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 3 of 4
(931 Views)

Currently I'm doing exactly what Mateusz suggests. This way is functional but more of a workaround.

 

Unfortunately I do not own the code. It is used by other colleagues who might not be willing to go the extra mile for testing integration.

 

Thanks for the hint regarding wrapping, ee-jallen. I'll investigate and see if it helps.

 

🙂

0 Kudos
Message 4 of 4
(912 Views)