猴子测试

Android monkey

今天的任务是聘请一只猴子来帮忙进行压力测试。

$adb shell monkey -p [package name] -v [times]

package name: 要测试的程序包名

times:要发送的随机指令的数量

 

? View Code BASH
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
ADB="ziiadb"
times=1000
 
if [ -z $1 ]; then 
    echo "Input a number to repeat monkey e.g: go_monkey!.sh 1000"
    exit 0
else
    times=$1
fi
 
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+                         GO! MONKEY!                           +"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
 
cat AndroidManifest.xml | grep "package name"
 
package_name=$(cat AndroidManifest.xml |grep package= |cut -d "=" -f2|sed 's/"//g')
 
echo $package_name
 
$ADB shell monkey -p $package_name -v $times

你可能感兴趣的:(猴子测试)