|Information in this topic applies to desktop applications only.|
|Connected and Self-Testing applications are deprecated. These technologies will be removed in one of the future releases of TestComplete.
To create test code that runs from within your tested apps, use TestLeft, a SmartBear functional testing tool for developers.
Connect class is used to address global programming objects of TestComplete from Connected Applications. This class contains wrappers for the program objects and global constants that you can use in scripts. For instance:
Connect.Sys- Provides access to the Sys object.
Connect.Log- Provides access to the Log object.
Connect.TestedApps- Provides access to the TestedApps object.
Connect.Regions- Provides access to the Regions object.
Therefore, the methods of this class may address these properties without using
To use this class in your Connected Application, add the line
to the source file that contains the test code. Note that you can skip
Connect if the class whose methods contain the test code is inherited from the
Connect class (see below).
Note that the
Connect class contains fields for TestComplete standard objects (
Regions and others). It does not contain fields for objects provided by third-party plugins. To obtain these objects, use the
GetObjectByName method of the
var MyObject = Connect.Integration["GetObjectByName"]("MyObjectName");
If your test class is not inherited from
Connect, you should prefix the names of TestComplete program objects in imported script routines with
Connect. For instance:
Connect.Log["Message"]("My message"); // Calls the Log.Message method
Connect.Sys["Desktop"]["ActiveWindow"](); // Calls the Sys.Desktop.ActiveWindow method
int i = Connect.Sys["MouseX"]; //Getting the Sys.MouseX property
Connect.Sys["MouseX"] = 120; // Setting the Sys.MouseX property
Another approach is to create a test class that will contain the script code and will be inherited from
Connect. Then, you can use this class in the same manner as you do this in TestComplete scripts:
Log["Message"]("My message"); // Calls the Log.Message method
Sys["Desktop"]["ActiveWindow"](); // Calls the Sys.Desktop.ActiveWindow method
int i = Sys["MouseX"]; // Getting the Sys.MouseX property
Sys["MouseX"] = 120; // Setting the Sys.MouseX property
For more information on testing applications from Connected Applications with TestComplete, see Connected Applications - Overview