使用Monkey,可以对应用的稳定性和健壮性进行压测,测试的结果对于产品在复杂环境下的运行情况有非常重要的参考意义。
下面是一个示例,带有相应的注释,简单明了,供大家参考。
#!/bin/bash # define case base information case_name="monkey case" case_ver="1.0.2" case_package_name="cn.packagename.platform" case_event_scale=5000 echo "-------------------------------------" echo "Job name:${case_name}, ver:${case_ver}" echo "-------------------------------------" # start job echo "List all connected device and checking them..." current_date=`date "+%Y-%m-%d %H:%M:%S"` adb devices > devices.list if grep -q " device" devices.list then echo "The package ready for send pseudo random event" echo "Case starting..." adb shell monkey -p ${case_package_name} -v ${case_event_scale} --pct-motion 50 --pct-syskeys 30 --monitor-native-crashes current_date=`date "+%Y-%m-%d %H:%M:%S"` current_msg='Finished!' else current_date=`date "+%Y-%m-%d %H:%M:%S"` current_msg="WARNNING!!! No devices connected!" echo "[${current_date}]${current_msg}" > error.log fi # finished echo "[${current_date}]${current_msg}" echo "Quiting..."
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-11-09 02:47:49