|Information in this topic applies to desktop and web applications.|
In certain cases, you may find it useful to automatically shut down or restart the computer after the test run. For example, when running regression tests on a Friday after your work day is over, you may want the computer to be turned off once the tests are done so that it is not left idle for the rest of the weekend.
TestComplete provides special methods for these scenerios:
Sys.Shutdown method logs off the operating system and then shuts down the computer. The
Sys.Restart method does the same and additionally reboots the computer.
Usually, you would add a call to one of these methods at the end of your test or in the
OnStopTest event handler to perform shutdown or restart after the test run. For example, to automatically shut down the computer once the test is over, insert the following line at the end of your test:
To use the
Sys.Restart method, TestComplete must be running with administrator privileges.
When using the
Sys.Restart method, please note that it does not log onto the operating system after restart. If you need to reboot the computer, log on and continue test run, call the
aqEnvironment.RebootAndContinue method instead. For more information, see Rebooting the Computer During Automated Testing.
Rebooting the Computer During Automated Testing