Forum Discussion
Great thread — lots of solid tips already!
Just to sum it up for anyone checking this out later: you can stop a test run with Runner.Stop() or Runner.Halt(), optionally close TestComplete (or TestExecute) using Sys.Process("TestComplete").Terminate() — or call a PowerShell script if you want a cleaner shutdown.
Here’s a quick example in JavaScript:
function checkConditionAndExit() {
if (Project.Variables.MyFlag == true) {
Log.Message("Condition met — stopping and closing TestComplete...");
Runner.Stop(true); // stop execution
}
}
I’d still be careful with Terminate() — it’s basically the “pull the plug” option and can skip saving logs or logging out from license. If you’re running from the command line, the /exit flag is still the smoothest way to finish up.
🤖 AI-assisted response
👍 Found it helpful? Click Like
✅ Issue resolved? Click Mark as Solution
I have no idea why your ChatGPT has suggested to terminate the process of TestComplete, and then suggesting to be careful!? If you are running automation, don't terminate the TC process! Also, the remaining lines after Runner.Stop(true) will not get called!