Termux-based mobile phone automation test environment building method, system, device and medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-18
- Publication Date
- 2026-08-11
AI Technical Summary
[0007]本发明的技术任务是提供一种基于Termux的手机自动化测试环境搭建方法、系统、设备及介质,来解决传统移动端自动化测试高度依赖PC机、环境配置复杂且难以隔离的问题
(一)本发明以Android终端上的Termux环境为基座,通过自动化脚本部署完整的Linux测试工具链;构建集成Web服务的轻量级控制中枢,实现浏览器远程访问与指令下发;设计基于SSH或ADB的测试执行与结果回传机制,实现了在单台Android手机上构建独立、可移植、一体化的自动化测试环境,摆脱了对PC的依赖,简化了环境搭建流程,提升了测试灵活性与资源利用率,解决了传统移动端自动化测试高度依赖PC机、环境配置复杂且难以隔离的技术问题,特别适用于移动端开发、测试及教育演示场景;
Smart Images

Figure CN122547701A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of mobile application development and testing technology, specifically a method, system, device, and medium for building an automated mobile testing environment based on Termux. Background Technology
[0002] In the mobile application development cycle, automated testing is a crucial step in ensuring software quality and improving iteration efficiency. Traditional mobile automated testing (such as Appium and UI Automator testing) typically relies on a PC as the control center. Test scripts are written and executed on the PC, controlling the mobile device via USB or network connection. This model has the following significant drawbacks: ① Strong environmental dependence: Test execution must be tied to a PC, making it impossible to conduct tests anytime and anywhere, and limiting the mobility of testers.
[0003] ② High configuration complexity: It requires the installation of JDK, Android SDK, Node.js, Appium server and various drivers on PC, and the environment configuration is cumbersome and prone to conflicts.
[0004] ③ Resource monopoly: During testing, the PC and mobile phone are occupied simultaneously, which is not conducive to efficient resource reuse.
[0005] ④ Poor environmental consistency: Environmental differences on different PCs may lead to inconsistent test results, increasing the difficulty of troubleshooting. While existing technologies attempt to run some test scripts on mobile devices, there is a lack of a complete and systematic method to integrate the test framework, execution engine, control interface, and result management on the mobile device, forming an independent, closed-loop test environment.
[0006] Therefore, how to utilize the computing and display capabilities of Android phones to build an automated testing environment that is independent of PCs, easy to configure, fully functional, and remotely controllable is a technical problem that urgently needs to be solved. Summary of the Invention
[0007] The technical objective of this invention is to provide a method, system, device, and medium for building a mobile automated testing environment based on Termux, in order to solve the problems of traditional mobile automated testing being highly dependent on PCs, having complex environment configurations, and being difficult to isolate.
[0008] The technical objective of this invention is achieved as follows: a method for building an automated mobile testing environment based on Termux, the specific method of which is as follows: Automated deployment base environment: Based on the Termux environment on the Android terminal, the scripts in the Termux environment automatically install Linux-based toolchains (such as Python, Node.js, Git), testing frameworks (such as Appium, Pytest) and necessary dependencies; Build a lightweight control hub: Deploy a control service that integrates a web server (such as Flask or Express) in the Termux environment. The control service provides a RESTful API and a web interface to receive test commands, manage test tasks, and display test reports. Integrated local execution engine: Configure the Termux environment so that it can directly call the testing tools provided by the Android system (such as calling uiautomator through termux-api or internal ADB connection) or run Appium-based test nodes, thereby enabling test drivers for the phone itself or other Android devices connected via the network. Establish internal and external network access channels: Start the Termux SSH daemon or use ngrok's intranet penetration tool to expose the web service to the public network, so that external devices (such as another mobile phone, tablet or PC) can remotely access the control center of the corresponding test environment via SSH or a browser to remotely trigger tests and view results.
[0009] As a preferred option, the automated deployment base environment completes the automated installation and configuration of Python, Node.js runtime environment, Appium server, test library and web framework by running pre-built shell scripts.
[0010] As a preferred option, the automated deployment base environment is as follows: Execute the `pkg update` command to update the package list, and use the `pkg upgrade -y` command to automatically confirm and upgrade all installed packages to the latest version; The command `pkg install python nodejs git wget -y` automatically confirms and installs the Python, Node.js, Git, and Wget packages. Run the command `pip install pytest appium-python-client flask` to install pytest, appium-python-client, and Flask using pip, Python's package manager. Pytest is a tool library for writing test code; appium-python-client is a client library for Python to interact with Appium; and Flask is a Python micro-framework for building web applications. Use the command `npm install -g appium` to globally install Appium using npm, the package manager for Node.js; Appium is an open-source tool for automated testing of mobile applications. Execute git clone<web_control_center_repo> The command will specify the Web Control Center code repository (<web_control_center_repo> (This needs to be replaced with the actual repository address) Clone it to your local machine.
[0011] Preferably, the web server's control service is implemented through the `run_test` route in `app.py`. The `run_test` route defines an endpoint ` / run_test` that handles HTTP POST requests using `@app.route(' / run_test', methods=['POST'])`. When a client sends a POST request to the endpoint that handles HTTP POST requests, the `run_test()` function is triggered, as follows: Receive test script: Extract the file named script (i.e., the Python test script uploaded by the user) from the request object request.files; Asynchronous test execution: The test script is executed asynchronously by starting a separate Python subprocess using subprocess.Popen(['python', test_script_path]). The asynchronous call method ensures that the test script runs in the background and does not block the Flask main thread from responding to other requests. Returning execution result: Returns a JSON-formatted response body to the client, containing the following two key fields: Status: 'started' indicates that the test task has started successfully; task_id: The task_id returns a unique task identifier generated by the system, which can be used to query test progress or results later.
[0012] As a preferred option, the local execution engine configuration includes the following: Testing native applications: Configure the Termux environment to enable the local execution engine to interact with the mobile system via the termux-am command or a local TCP connection to trigger UI events; Testing multiple devices: Start an Appium node in the Termux environment, connect to and control other Android devices on the local network via Wi-Fi.
[0013] As a preferred method, to enable SSH in Termux, you need to: start the sshd service and set a password; The ngrok tunneling tool obtains a temporary publicly accessible address via ngrok http 5000.
[0014] Better still, the local test execution engine can achieve automated testing of the application interface of the host machine (i.e., this mobile phone) or other Android devices in the local area network through the API interface provided by Termux or the internal network ADB connection; The web server's control service provides a graphical interface for uploading test scripts, triggering test execution, viewing test logs in real time, and generating visual test reports.
[0015] A Termux-based automated mobile testing environment setup system, which implements the Termux-based automated mobile testing environment setup method described above; the system includes: The base environment automated deployment module is used to automatically install Linux-based toolchains (such as Python, Node.js, Git), testing frameworks (such as Appium, Pytest), and necessary dependencies in the Termux environment on Android terminals via scripts. A lightweight control hub building module is used to deploy a control service with an integrated web server (such as Flask or Express) in the Termux environment. The control service provides a RESTful API and a web interface for receiving test commands, managing test tasks, and displaying test reports. The local execution engine integration module is used to configure the Termux environment so that the Termux environment can directly call the testing tools provided by the Android system (such as calling uiautomator through termux-api or internal ADB connection) or run Appium-based test nodes, thereby enabling test drivers for the phone itself or other Android devices connected via the network. The module for establishing internal and external network access channels is used to start the Termux SSH daemon or use ngrok's intranet penetration tool to expose the web service to the public network, enabling external devices (such as another mobile phone, tablet, or PC) to remotely access the control center of the corresponding test environment via SSH or a browser, thereby enabling remote triggering of tests and viewing of results.
[0016] An electronic device includes: a memory and at least one processor; The memory contains computer programs; The at least one processor executes the computer program stored in the memory, causing the at least one processor to execute the Termux-based mobile automated testing environment setup method described above.
[0017] A computer-readable storage medium storing a computer program that can be executed by a processor to implement the Termux-based mobile automated testing environment setup method described above.
[0018] The method, system, device, and medium for building a mobile automated testing environment based on Termux of the present invention have the following advantages: (i) This invention uses the Termux environment on an Android terminal as a base and deploys a complete Linux testing toolchain through automated scripts; it builds a lightweight control center integrating Web services to enable remote access and command issuance via browser; it designs a test execution and result feedback mechanism based on SSH or ADB, realizing the construction of an independent, portable, and integrated automated testing environment on a single Android phone, eliminating dependence on PCs, simplifying the environment setup process, improving testing flexibility and resource utilization, and solving the technical problems of traditional mobile automated testing being highly dependent on PCs, having complex environment configurations, and being difficult to isolate. It is particularly suitable for mobile development, testing, and educational demonstration scenarios. (ii) This invention realizes the "mobile phoneization" of the testing environment. Testers only need a mobile phone to complete the entire set of automated testing work, which greatly improves flexibility and convenience and gets rid of PC dependence; (iii) This invention automates the deployment of scripts, enabling the setup of complex environments with a single click, thereby reducing the entry barrier and maintenance costs and simplifying environment configuration; (iv) The present invention provides an independent testing environment on each mobile phone, avoiding the problem of conflict between multiple project environments on the PC, achieving environmental isolation and ensuring the consistency of test results; (v) This invention makes full use of the computing power of idle mobile phones, realizes the distributed deployment and elastic expansion of test resources, and achieves efficient use of resources; (vi) This invention allows test managers to remotely view test progress and results through a web interface, and supports collaborative work and remote cooperation. Attached Figure Description
[0019] The invention will be further described below with reference to the accompanying drawings.
[0020] Appendix Figure 1 A flowchart illustrating the method for setting up a mobile automated testing environment based on Termux. Detailed Implementation
[0021] The following detailed description of the Termux-based automated mobile phone testing environment construction method, system, device, and medium of the present invention is provided with reference to the accompanying drawings and specific embodiments. Example
[0022] As attached Figure 1 As shown in the figure, this embodiment provides a method for building a mobile automated testing environment based on Termux. The method is as follows: S1. Automated Deployment Base Environment: Based on the Termux environment on the Android terminal, the Termux environment automatically installs Linux-based toolchains (such as Python, Node.js, Git), testing frameworks (such as Appium, Pytest), and necessary dependencies through scripts. S2. Build a lightweight control hub: Deploy a control service that integrates a web server (such as Flask or Express) in the Termux environment. The control service provides a RESTful API and web interface to receive test commands, manage test tasks, and display test reports. S3. Integrated local execution engine: Configure the Termux environment so that it can directly call the testing tools provided by the Android system (such as calling uiautomator through termux-api or internal ADB connection) or run Appium-based test nodes to drive testing of the phone itself or other Android devices connected through the network. S4. Establish internal and external network access channels: Start the Termux SSH daemon or use ngrok's intranet penetration tool to expose the web service to the public network, so that external devices (such as another mobile phone, tablet or PC) can remotely access the control center of the corresponding test environment through SSH or a browser to remotely trigger tests and view results.
[0023] In this embodiment, step S1, the automated deployment of the base environment, completes the automated installation and configuration of Python, Node.js runtime environment, Appium server, test library, and web framework by running a pre-built shell script; the specific process of the automated deployment of the base environment is as follows: start ↓ Install Termux on Android phones ↓ Runtime environment initialization script (setup.sh) ↓ ├── Update source and install basic package ├── Install the programming language environment (Python / Node.js) ├── Install the testing framework and its dependencies (Appium, Pytest) ├── Deploy Web Control Service Code Configure services to start automatically (such as sshd, web service). ↓ Start the Web control service and SSH service ↓ The environment is ready and can be accessed via IP:port. ↓ Finish.
[0024] The automated deployment of the base environment in step S1 of this embodiment is as follows: S101. Execute the pkg update command to update the package list, and use the pkg upgrade -y command to automatically confirm and upgrade all installed packages to the latest version; S102. The command `pkg install python nodejs git wget -y` automatically confirms and installs the Python, Node.js, Git, and Wget packages. S103. Run the command `pip install pytest appium-python-client flask` to install pytest, appium-python-client, and Flask using pip, Python's package management tool. Pytest is a tool library for writing test code; appium-python-client is a client library for Python to interact with Appium; and Flask is a Python micro-framework for building web applications. S104. Use the command `npm install -g appium` to globally install Appium using npm, the package manager for Node.js. Appium is an open-source tool for automated testing of mobile applications. S105, Execute git clone<web_control_center_repo> The command will specify the Web Control Center code repository (<web_control_center_repo> (This needs to be replaced with the actual repository address) Clone it to your local machine.
[0025] In this embodiment, the control service of the web server in step S2 is implemented through the run_test route in app.py. The run_test route defines an endpoint / run_test that handles HTTP POST requests through @app.route(' / run_test', methods=['POST']). When the client sends a POST request to the endpoint that handles HTTP POST requests, the execution of the run_test() function is triggered, as follows: S201. Receive test script: Extract the file named script (i.e., the Python test script uploaded by the user) from the request object request.files. S202. Asynchronous test execution: Start an independent Python subprocess to asynchronously execute the test script using subprocess.Popen(['python', test_script_path]). The asynchronous call method ensures that the test script runs in the background and will not block the Flask main thread from responding to other requests. S203. Return execution result: Return a JSON format response body to the client, containing the following two key fields: ①Status: 'started' indicates that the test task has been successfully started; ②task_id: The task_id returns a unique task identifier generated by the system, which is used for subsequent queries of test progress or results.
[0026] In step S2 of this embodiment, the control service of the Web server provides a graphical interface for uploading test scripts, triggering test execution, viewing test logs in real time, and generating visual test reports.
[0027] The local execution engine configuration in step S3 of this embodiment includes the following situations: ① Test native applications: Configure the Termux environment to enable the local execution engine to interact with the mobile phone system via the termux-am command or a local TCP connection to trigger UI events; ② Test multiple devices: Start the Appium node in the Termux environment, connect to and control other Android devices on the local area network via Wi-Fi.
[0028] In step S3 of this embodiment, the local test execution engine uses the API interface provided by Termux or the internal network ADB connection to automate the testing of the application interface of the host machine (i.e., this mobile phone) or other Android devices in the local area network.
[0029] In this embodiment, starting Termux's SSH specifically involves starting the sshd service and setting a password.
[0030] In this embodiment, ngrok's intranet penetration tool obtains a temporary address accessible from the public network through ngrok http 5000.
[0031] The specific execution flow at this remote location in this embodiment is as follows: Start (Remote Browser) ↓ Access the Termux Web Control Interface ↓ Upload test script / Select test cases ↓ Click the "Execute Test" button ↓ Web services add tasks to a queue. ↓ The test execution engine retrieves and runs tasks. ↓ ├── Driver for the application under test ├── Perform UI operations and assertions └── Record execution logs and screenshots ↓ Generate test reports (HTML / JSON) ↓ Web interface updated, displaying report link. ↓ Finish. Example
[0032] This embodiment provides a Termux-based automated mobile testing environment setup system, which implements the Termux-based automated mobile testing environment setup method described above; the system includes: The base environment automated deployment module is used to automatically install Linux-based toolchains (such as Python, Node.js, Git), testing frameworks (such as Appium, Pytest), and necessary dependencies in the Termux environment on Android terminals via scripts. A lightweight control hub building module is used to deploy a control service with an integrated web server (such as Flask or Express) in the Termux environment. The control service provides a RESTful API and a web interface for receiving test commands, managing test tasks, and displaying test reports. The local execution engine integration module is used to configure the Termux environment so that the Termux environment can directly call the testing tools provided by the Android system (such as calling uiautomator through termux-api or internal ADB connection) or run Appium-based test nodes, thereby enabling test drivers for the phone itself or other Android devices connected via the network. The module for establishing internal and external network access channels is used to start the Termux SSH daemon or use ngrok's intranet penetration tool to expose the web service to the public network, enabling external devices (such as another mobile phone, tablet, or PC) to remotely access the control center of the corresponding test environment via SSH or a browser, thereby enabling remote triggering of tests and viewing of results.
[0033] The working process of this system is as follows: [Remote control terminal (browser / SSH client)] ↓ (HTTP / SSH) [Termux environment (mobile)] ├── Web Control Service (Flask / Express) ←→ Test Task Queue ├── Test execution engine (Appium node / Python script) → Invoke → [Android system UIAutomator / ADB] ├── Results Storage and Report Generation Module └── Environment configuration and dependency management scripts.
[0034] The key code executed by the automated deployment module of the base environment in this embodiment is as follows: Example of the core part of the setup.sh script pkg update && pkg upgrade -y pkg install python nodejs git wget -y pip install pytest appium-python-client flask npm install -g appium git clone<web_control_center_repo> .
[0035] The control service implementation code of the Web server of the lightweight control hub construction module in this embodiment is as follows: # app.py (Flask example) Core routing @app.route(' / run_test', methods=['POST']) def run_test(): test_script = request.files['script'] # Save the script and execute it asynchronously in a child process. subprocess.Popen(['python', test_script_path]) return jsonify({'status': 'started', 'task_id': task_id}).
[0036] The local execution engine configuration in this embodiment is as follows: Option A (Testing native applications): Configure Termux to interact with the mobile system via commands such as termux-am or a local TCP connection to trigger UI events.
[0037] Option B (Testing Multiple Devices): Start an Appium node in Termux and connect to and control other Android devices on the local network via Wi-Fi.
[0038] The access and security settings for the internal and external network access channel establishment module in this embodiment are as follows: Start Termux's SSH service: sshd, and set a password; or, use ngrok to expose the web service port: ngrokhttp 5000, to obtain a temporary publicly accessible address. Example
[0039] This embodiment also provides an electronic device, including: a memory and a processor; The memory stores the instructions executed by the computer. The processor executes computer execution instructions stored in the memory, causing the processor to execute the Termux-based mobile phone automated testing environment construction method in any embodiment of the present invention.
[0040] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor can be a microprocessor or any conventional processor.
[0041] Memory can be used to store computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, at least one application program required for a function, etc.; the data storage area can store data created based on the use of the terminal, etc. In addition, memory can also include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart memory cards (SMC), secure digital cards (SD cards), flash memory cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices. Example
[0042] This embodiment also provides a computer-readable storage medium storing multiple instructions, which are loaded by a processor to cause the processor to execute the Termux-based mobile phone automated testing environment setup method according to any embodiment of the present invention. Specifically, a system or device equipped with a storage medium may be provided, on which software program code implementing the functions of any of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device may read and execute the program code stored in the storage medium.
[0043] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.
[0044] Storage media embodiments for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.
[0045] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0046] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion unit connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion unit execute some and all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0047] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A Termux-based mobile phone automatic test environment building method, characterized in that, The method is as follows: Automated deployment of the base environment: Based on the Termux environment on the Android terminal, scripts are used in the Termux environment to automatically install the Linux-based toolchain, testing framework and necessary dependencies. Build a lightweight control hub: Deploy a control service with an integrated web server in the Termux environment. The control service provides a RESTful API and a web interface to receive test commands, manage test tasks, and display test reports. Integrated local execution engine: Configure the Termux environment to enable it to directly call the testing tools provided by the Android system or run Appium-based test nodes, thereby driving the testing of the phone itself or other Android devices connected via the network. Establish internal and external network access channels: Start the Termux SSH daemon or use ngrok's intranet penetration tool to expose the web service to the public network, so that external devices can remotely access the control center of the corresponding test environment via SSH or a browser, and realize remote triggering of tests and viewing of results.
2. The Termux-based mobile phone automation test environment building method according to claim 1, characterized in that, The automated deployment base environment completes the automated installation and configuration of Python, Node.js runtime environment, Appium server, test library and web framework by running pre-built shell scripts.
3. The Termux-based mobile phone automation testing environment building method according to claim 1, characterized in that, The automated deployment base environment is as follows: Execute the `pkg update` command to update the package list, and use the `pkg upgrade -y` command to automatically confirm and upgrade all installed packages to the latest version; The command `pkg install python nodejs git wget -y` automatically confirms and installs the Python, Node.js, Git, and Wget packages. Run the command `pip install pytest appium-python-client flask` to install pytest, appium-python-client, and Flask using pip, Python's package manager. Pytest is a tool library for writing test code; appium-python-client is a client library for Python to interact with Appium; and Flask is a Python micro-framework for building web applications. Use the command `npm install -g appium` to globally install Appium using npm, the package manager for Node.js; Appium is an open-source tool for automated testing of mobile applications. Execute git clone<web_control_center_repo> This command clones the specified Web Control Center code repository to the local machine.
4. The Termux-based mobile phone automation test environment building method according to claim 1, characterized in that, The web server's control service is implemented through the `run_test` route in `app.py`. The `run_test` route defines an endpoint ` / run_test` that handles HTTP POST requests using `@app.route(' / run_test', methods=['POST'])`. When a client sends a POST request to this endpoint, the `run_test()` function is triggered, as follows: Receive test script: Extract a file named script from the request object request.files; Asynchronous test execution: Start a separate Python subprocess to asynchronously execute the test script using subprocess.Popen(['python', test_script_path]); Returning execution result: Returns a JSON-formatted response body to the client, containing the following two key fields: Status: 'started' indicates that the test task has started successfully; task_id: The task_id returns a unique task identifier generated by the system, which can be used to query test progress or results later.
5. The Termux-based mobile phone automation testing environment building method according to claim 1, characterized in that, The local execution engine configuration includes the following: Testing native applications: Configure the Termux environment to enable the local execution engine to interact with the mobile system via the termux-am command or a local TCP connection to trigger UI events; Testing multiple devices: Start an Appium node in the Termux environment, connect to and control other Android devices on the local network via Wi-Fi.
6. The Termux-based mobile phone automation testing environment building method according to claim 1, characterized in that, To enable SSH in Termux, you need to: start the sshd service and set a password; The ngrok tunneling tool obtains a temporary publicly accessible address via ngrok http 5000.
7. The Termux-based mobile phone automation testing environment building method according to any one of claims 1 to 6, characterized in that, The local test execution engine uses the API provided by Termux or the internal network ADB connection to automate the testing of application interfaces on the host machine or other Android devices within the local area network. The web server's control service provides a graphical interface for uploading test scripts, triggering test execution, viewing test logs in real time, and generating visual test reports.
8. A system for building an automated mobile testing environment based on Termux, characterized in that, This system is used to implement the Termux-based mobile automated testing environment setup method as described in any one of claims 1 to 7; the system includes: The automated deployment module for the base environment is used to automatically install Linux-based toolchains, testing frameworks and necessary dependencies in the Termux environment on Android terminals via scripts. A lightweight control hub building module is used to deploy a control service with an integrated web server in the Termux environment. The control service provides a RESTful API and a web interface for receiving test commands, managing test tasks, and displaying test reports. The local execution engine integration module is used to configure the Termux environment so that it can directly call the testing tools provided by the Android system or run Appium-based test nodes, thereby enabling test drivers for the phone itself or other Android devices connected via the network. The module for establishing internal and external network access channels is used to start the Termux SSH daemon or use ngrok's intranet penetration tool to expose the web service to the public network, enabling external devices to remotely access the control center of the corresponding test environment via SSH or a browser, thereby enabling remote triggering of tests and viewing of results.
9. An electronic device, characterized in that, include: Memory and at least one processor; The memory contains computer programs; The at least one processor executes the computer program stored in the memory, causing the at least one processor to perform the Termux-based mobile phone automated testing environment setup method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed by a processor to implement the method for building a Termux-based automated testing environment for mobile phones as described in any one of claims 1 to 7.