Android uiautomator automated testing, androiduiautomator
The premise is that JDK, android, and ant environments are configured on your computer.
1. Go to the \ Android-sdk \ tools \ directory under the command line and run the following command:
Android list
View the android sdk id and find your mobile phone.
Or the version of the simulator.
2. Run the following command in the \ Android-sdk \ tools \ directory:
Android create uitest-project-n <name>-t <android-sdk-ID>-p <path>
For example:
Android create uitest-project-n AutoRunner-t 60-p f: \ uiautomator
AutoRunner: the name of the jar package to be generated.
60: ID of the android SDK corresponding to your mobile phone or Simulator version
F: \ uiautomator: path of your project (absolute path)
3. Enter the project directory under the command line, and then run ant build to generate jar using ant compilation,
Then, the jar file is generated in the bin directory.
4. Install and run
Adb push <jar file path> data/local/tmp
Adb shell uiautomator runtest <jar File Name>-c <class name in the project, including package name>
For example:
Installation: adb push f: \ uiautomator \ bin \ AutoRunner. jar data/local/tmp
Where: f: \ uiautomator \ bin \ AutoRunner. jar full path of the jar package generated in step 3
Data/local/tmp: the installation path of the mobile phone or Simulator
Run: adb shell uiautomator runtest AutoRunner. jar-c com. Runner
Here, AutoRunner. jar: The jar package generated in step 3 (not the complete path)
Com. uiautomator. testcase. LaunchSettings: complete package name + Class Name of the class to be run