What is Monkey?
Monkey is a command-line tool provided by Google for stability and stress testing.
Monkey path:
Path:/system/framework/monkey.jar
Startup script path:/system/bin/monkey
1. First we open the Android simulator first
2. Open the local cmd command window
3. Enter the command to see if the emulator has a connection
ADB devices, which appears as indicated in the connected
4. You can then enter the ADB shell command into the monkey path to execute monkey test.
cd/system/framwork/successfully enter the directory and then find out if there is a monkey jar package
5. Fuzzy query containing monkey command: ls | grep Monkey, you can see that there are monkey.jar bags inside.
6. Let's look at the startup script cd/system/bin/successfully into the directory and enter the command: LS | grep Monkey Find out if there's a monkey startup script
You can see that there's a monkey startup script.
The configuration of the environment variables mentioned in the previous section the children's shoes know what they're doing.
Configure the environment for ADB
The monkey is initiated by the ADB command, so configure the ADB environment
1. Download the Android SDK, unzip
2. Configure the Platform-tools and tools directories in the SDK directory to the system change environment variable
3. Open CMD window, enter ADB, have ADB help information to configure success
Install APK file
First copy the APK package that needs to be tested to the Platform-tools directory
Then execute the install command adb install test.apk
One of the points to note is that when you execute the installation command, you need to go to that directory, and the directory on my side is
E:\Android\android-sdk\platform-tools
Command format:
1.PC Boot
>ADB shell Monkey [option] <count> "[]" optional parameters, can not fill, "<>" inside the parameters are required, will not fill in the error
2.shell End Start
> adb shell
>monkey [Optinon] <count>
What is the difference between the two ways, the first PC boot, the results can be saved on the PC side, the second mobile phone side start, the results can only be saved on the phone.
Of course, when you run monkey log, it's also possible to save it.
Save Log for Monkey run
1. Save in PC adb shell monkey [option] <count> > d:\monkey.txt
2. Save on Phone monkey [option] <count> > /mnt/sdcard/monkey.txt
3. The standard stream is saved separately from the error stream
Monkey [option] <count> 1> /mnt/sdcard/monkey.txt 2> /mnt/sdcard/error.txt
Android automated Stress test Monkey Test (iii)