How to Use TestHub Open‑Source Platform for Mobile App Automation Testing
This guide walks through the complete workflow of using the open‑source TestHub platform to automate a mobile app—splitting a business process, connecting a device, creating a project and elements, arranging test cases, executing them, viewing reports, and troubleshooting common issues.
1. Break Down Business Process
Using the “Gaode Dache” (Gaode ride‑hailing) flow as an example, the article shows how to translate manual steps into an automated test.
Open the Gaode Map app.
Tap “Ride” to enter the ride‑hailing module.
Enter the destination and search.
Select the destination from the search results.
Confirm and start the ride (optionally choose a ride type such as Fast or Premium).
2. Connect Device
Enable USB debugging on the phone, connect the phone to the computer via a USB cable, allow the debugging prompt, refresh the device manager and ensure the device appears as available.
3. Create Project
Navigate to the APP automation testing – Project Management section and create a new project.
4. Create Elements
For each UI component involved in the manual flow, create a corresponding element in TestHub so it can be referenced later.
4.1 Add “Gaode Dache” Element
Enter the element management page, click “Create from Device”, select the connected phone, take a screenshot, and fill in the form (element name, project, element type – image, coordinate or region, image category, template file name, etc.).
Save the element; it now appears in the element list.
4.2 Add “Ride” and Other Operative Elements
Repeat the process to create the “Ride” button element, the destination search box, the input field for the endpoint, and the confirmation element.
Resulting element list:
Gaode Map – opens the Gaode app.
Ride icon – enters the ride‑hailing module.
Destination search box – opens the input field.
Endpoint input – enters the destination.
Destination – confirms the selected location.
5. Arrange Test Case
Drag basic components (click, input, swipe, wait, etc.) from the component library to the scenario steps panel, then select the corresponding element for each step. The final scenario consists of a sequence of “element + operation” pairs.
After arranging, click “Save Test Case”.
6. Execute Test Case
After saving, the test case appears in the test case list. Click “Run” to start execution.
Make sure Redis is installed and running, and the Celery worker is started.
# 启动Celery
celery -A backend worker -l info7. View Report
After execution, open Report Management → Test Case Report to view detailed results.
8. Common Issues
8.1 Component Not Initialized
The element management page may show “No component definition, please initialize the component library first.”
# 初始化app自动化组件库
python manage.py load_component_pack8.2 Test Case Execution Always Fails
Check that Redis is running and the Celery queue is active.
Redis has started and is connected. Celery queue is running.
# 启动Celery
celery -A backend worker -l infoSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
