In most cases we will need to run tested applications automatically from the test scripts, not manually from TestComplete IDE.
In this recipe we will learn how to launch tested applications from the script.
Add the Calculator Plus and Notepad applications to the application project (right-click on TestedApps, and select Add | New Item). These applications can be located through the following paths:
C:Program FilesMicrosoft Calculator PlusCalcPlus.exe
C:Windows
otepad.exe
In order to run a tested application we need to perform the following steps:
function testRunApps() { var pCalc = TestedApps.CalcPlus.Run(); var pNotepad = TestedApps.notepad.Run(); }
This code will run both tested applications using the Run
method.
Each tested application item has the Run
method, which is used for running applications under test. With help of this method, the application is launched in the mode specified by its
Run Mode property.
The Run
method returns the process object of the launched application, which can be used further in script for interaction with the application under test.
If for some reason run attempt fails, an error will be generated: Unable to run "<PATH_TO_THE_APPLICATION>".
3.144.39.144