This repository contains the artifacts related to model-based GUI testing for HarmonyOS apps.
To run this project, you need the environment as follows.
- Operating System: windows 10 64-bit or windows 11 64-bit
- Memory: 16 GB RAM or higher
- Storage: 100 GB free space or more
- Display Resolution: 1280x800 pixels or higher
- Python: preferably version 3.x
- Node.js: version 16.x or higher recommended
- DevEco Studio: version 3.1 or 4.0 (You can install version 3.1 by deveco-studio-3.1.0.501.exe provided in this project.)
Clone the project.
git clone https://github.com/sqlab-sustech/HarmonyOS-App-Test.git
Enter the project folder and install the necessary third-party Node.js libraries.
cd HarmonyOS-App-Test
npm install
Modify the value of project
variable in script.py
to the folder path of the HarmonyOS app you would like to test on.
Then run script.py
.
python script.py
This will generate PTG.ets
, containing a json string which represents page transition graph extracted from the HarmonyOS app project by static analysis. Open the HarmonyOS app project using DevEco Studio, such as https://github.com/WinWang/HarmoneyOpenEye project listed in project.txt
. Copy Ability.test.ets
and PTG.ets
to the src/ohosTest/ets/test
folder in the HarmonyOS app project.
You can choose random strategy or model-based strategy to run with. Create a Huawei Phone Emulator in DevEco Studio. Open the phone, set the total testing time and run Ability.test.ets
with coverage. Finally you will get a .test
folder including coverage information of testing.
The demo video for this project is available at Model-Based GUI Testing for HarmonyOS Apps.
中文视频:模型驱动的鸿蒙应用自动化测试技术