Automating Test Cases using TestComplete Framework with Python
Automate desktop application tests with TestComplete and Python — identify UI objects with Object Spy, record scenarios, edit the Object Repository, and generate executable test scripts using algoQA.
Automate desktop application test cases by integrating algoQA with the TestComplete framework using Python. This guide walks you through designing tests, identifying UI objects with Object Spy, recording scenarios, editing the Object Repository, and generating test scripts for execution.
Prerequisites
To install TestComplete, see TestComplete Installation guide.
About TestComplete Framework
Currently applicable for: Desktop Application
TestComplete is an automated testing environment suitable for various application types and technologies, including Windows, Linux and Mac. It supports TestComplete and comes with built-in capability to utilize the Python language.
Use Case
This use case demonstrates the automation of a Calculator application by integrating algoQA with the TestComplete framework using the Python language. The example showcases an in-sprint automation process, automating the steps of adding two numbers and verifying the sum.
Test Design
Designing tests is creating an offline model of an application under test (AUT), which involves mimicking a UI model of an AUT using nodes, features and UI elements. For more information, see Profiling.
Using the TestComplete Object Spy Feature
To identify objects within your application for use in your test steps, you can use the TestComplete Object Spy feature. In this example, the calculator application is used to illustrate the process.
Follow these steps to prepare your application for automation testing and utilize the Object Spy.
- Launch the TestComplete tool from your desktop and click the Object Spy toolbar button as follows:

TestComplete toolbar with Display Object Spy icon highlighted and tooltip shown - The Object Spy window appears.

Object Spy window with Selected object field and Properties, Methods tabs - Determine the application you wish to inspect, and the application tab will display the current screen you intend to inspect. Similarly, you can identify all the necessary objects required.
- Mouse over the required object to inspect the element, and the selected element will be highlighted. All the properties will be displayed in the Properties tab. Choose the required attribute to locate the element.
- Navigate to Test Design and Controls to update the locator. You can update the locator fetched from the Object Spy tool and save it. Similarly, update all the locators required for the objects.

Controls list with Control Name, Value, Control Type, Locator columns and Record Scenario button
Recording Scenarios Using the Record Scenario Feature
The Record Scenario feature is used to record and save the workflow or scenario or use case. The scenario will be saved in the same sequence it has been recorded.
Recording for the Record Scenario feature is done in an offline model. It doesn't interact with the live application.
For more information, see Record a Scenario using Offline Recorder.
Editing Object Repository File
The Object Repository file is a spreadsheet with all the UI elements or control details.
It contains the Object Repository file and its contents:

| Field | Description |
|---|---|
| Control Name | Displays all the UI element/control names that were recorded in the scenario |
| Locator | Displays the locators to find the UI elements |
| Control Type | Displays the control types used to describe the nature and purpose of the UI elements |
| Control Identification Type | Displays the locator type of the UI element |
| Feature Name | Displays the feature name |
| Page Name | Displays the page name |
To edit the Object Repository file: After selecting a Project, navigate to Left Pane > Object Repository and update the required field in the Object Repository file and save the details.
Generating Test Cases and Test Scripts
This section helps you generate test cases and test scripts. Check Generate Test Cases and Test Scripts to generate scripts.
Execution of the Scripts
To execute scripts, refer to Executing Desktop Automation Scripts using TestComplete.