Forum Discussion
I ended up going with the option to user a PowerShell script. My normal script will run the PowerShell script and stop. This leaves TestComplete open but stopped. The PowerShell script pauses for 20 seconds (to ensure TestComplete has stopped) and then forces TestComplete to close. Not the most elegant, but it works.
rraghvani Could /exit work? It looks unlikely unless TC is started with the /run option given the docs. Have you had success?
/exit (or /e)
If this argument is used along with the /run argument, TestComplete will close after the project (or project suite) run is over. If the /exit command-line argument is used without /run, then neither the specified project (project) suite will be run, nor will TestComplete be closed.
Note: If you run tests, the project (or project suite) file will be changed because it will contain a reference to the new log file. TestComplete will display the Confirm dialog asking you to save the changes. To suppress displaying the dialog on exit, specify the /SilentMode command-line argument along with /exit.
Command-line arguments
https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/command-line.html#CommandLineArguments
- rraghvani31 days ago
Champion Level 3
Using /exit together with the appropriate parameters, works. To run TC scripts from the command prompt, you have to include /run, /project and/or /unit, /routine followed by /exit.
Based on my code example that I had given.- scot196731 days ago
Champion Level 3
Given this clip from the original post I think this isn't what is desired. But yes, I agree. It would work if started from the command line.
I know that the /exit option is available if I started the script from command line. But, I was looking for an option that would work when manually running scripts or running from command line.
- rraghvani31 days ago
Champion Level 3
You have to gracefully exit the application, and the only way of doing that, is by using the command line parameters. Any other alternative suggestions such as killing the process is not recommended.
It's like suggesting to pull the mains plug out to turn the computer off, it shouldn't be recommended!