Forum Discussion
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
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!
- scot196731 days ago
Champion Level 3
Let me get these posts in the right place...
I added my concern about terminating TC in one of the first post here. These would be my biggest concerns. I am not sure if the log file is being lost in the project or not, or if a licensing issue will be seen these are valid points to consider as well as the corruption the project file. I am sure this user has considered the risk.
...
I forgot about the .close and .terminate methods. If you can snag the TC process you may be able to use one of these methods. The terminate method is the more risky of the two but may be the only way. It just kills the process instead of asking politely to close properly.