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.
- rraghvani2 months ago
Champion Level 3
Have you tried with /exit command-line parameter, as opposed to terminating the process? Terminating the process, may not release the license and when you relaunch TC, it will say that the license is in use.
- scot196731 days ago
Champion Level 3
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.
- scot196731 days ago
Champion Level 3
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.
- scot196731 days ago
Champion Level 3
...
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.
- scot196731 days ago
Champion Level 3
Apologies, my last two posts are at the wrong nested level and were replies to rraghvani. I think this leveled nesting of comments is confusing. I like a flat structure using mentions with @....