How to wait for TestedApp to Finish and get Exit Code
I have a tested app called "python".
Application path: C:\Python312\python.exe
Command-line parameters: C:\Users\jondoe\Documents\iNext\main.py
The testedApp is called in a python function, which works well:
def runTestAppPython():
myApp = TestedApps.python
pyProcess = myApp.Run()
What needs to be done to make the function wait for myProcess to finish.
And how can I access the exit value of the testedApp in this function.
What I tried was
- pyProcess.Wait() to wait for the testedApp to finish, but does not work.
- pyProcess.ExitCode to get the exit value of the testedApp, but does not work, too.
Help is very appreciated.
Thank you.
Hi,
We call PowerShell from our scripts to compare files. We then get a return value from PS to determine if the files match. To accomplish this we use WshShell. Perhaps this could be adapted for your needs. Below is a VBScript code snippet.Here is a link to the docs: WshShell Object | TestComplete Documentation
Here is the code we use:
Set oShell = Sys.OleObject("WScript.Shell") '-- Compare the files using Powershell s_PowershellInput = "powershell -command Compare-Object -ReferenceObject $(Get-Content '" & RFile & "') -DifferenceObject $(Get-Content '" & TFile & "') | where {$_.SideIndicator -eq '<=' -and !$_.InputObject.StartsWith('#')} | select -ExpandProperty inputObject" Set oExec = oShell.Exec(s_PowershellInput) oExec.StdIn.Close ' Close standard input before reading output ' Get PowerShell output with the comparison results strOutput = oExec.StdOut.ReadAll '-- If strOutput is "" then the files matched If strOutput = "" Then AtsCompareFilesPS = True Else 'Return false and save the output to a text file in the same location as the test file AtsCompareFilesPS = False End If