標籤:軟體測試 monkey android自動化
使用Monkey,可以對應用的穩定性和健壯性進行壓測,測試的結果對於產品在複雜環境下的運行情況有非常重要的參考意義。
下面是一個樣本,帶有相應的注釋,簡單明了,供大家參考。
#!/bin/bash# define case base informationcase_name="monkey case"case_ver="1.0.2"case_package_name="cn.packagename.platform"case_event_scale=5000echo "-------------------------------------"echo "Job name:${case_name}, ver:${case_ver}"echo "-------------------------------------"# start jobecho "List all connected device and checking them..."current_date=`date "+%Y-%m-%d %H:%M:%S"`adb devices > devices.listif grep -q "device" devices.listthen 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.logfi# finishedecho "[${current_date}]${current_msg}"echo "Quiting..."
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。
基於Monkey的Android自動化測試