專項(xiàng)測試checklist
性能測試
耗電量測試
batteryhistory
instruments
卡頓測試
blockcanary
h5性能測試
devtool
headless
chrome
場景測試
兼容性測試
mqc mtc testln
appium grid stf
健壯性測試
monkey
弱網(wǎng)測試
facebok atc
proxy定制
安全測試
wvs
burpsuite
專項(xiàng)測試(技術(shù)維度)
崩潰
自動(dòng)遍歷
monkey測試
橫豎屏切換、快速進(jìn)退
卡頓(掉幀、gc、cpu)
卡頓測試
內(nèi)存泄漏測試
method profile
響應(yīng)慢(啟動(dòng)時(shí)間、交互響應(yīng)、H5)
冷熱啟動(dòng)
界面切換
h5性能測試
發(fā)熱(cpu、mem、io、network、gps等硬件使用)
method profile
gc統(tǒng)計(jì)
io統(tǒng)計(jì)
流量統(tǒng)計(jì)
硬件使用統(tǒng)計(jì)
耗電量分析
兼容性問題(機(jī)型覆蓋、回歸)
兼容性測試
自動(dòng)化測試
自動(dòng)遍歷
monkey測試
Activity啟動(dòng)流程
含義:在app中,每一個(gè)頁面就是一個(gè)Activity
啟動(dòng)過程
啟動(dòng)app:創(chuàng)建一個(gè)空白的窗口,啟動(dòng)app的進(jìn)程
啟動(dòng)application onCreate:創(chuàng)建一個(gè)對象
啟動(dòng)MainTread主線程
activity init:頁面進(jìn)程的創(chuàng)建,init都是進(jìn)程創(chuàng)建
Activity onCreate:創(chuàng)建activity對象,渲染整個(gè)頁面,創(chuàng)建好后,替換空白的頁面,就是整個(gè)==displayed time==結(jié)束的時(shí)候
other stuff:動(dòng)態(tài)加載頁面的過程,比如加載js、php等動(dòng)態(tài)資源
主要流程
application onCreate
加載第三方的sdk:加載第三方的服務(wù)
登錄使用第三方qq登錄
把內(nèi)容分享到微信
使用支付寶等支付手段
Activity onCreate(占用時(shí)間最長)
加載自身的邏輯
發(fā)送遠(yuǎn)程數(shù)據(jù)請求 xxx.json
渲染界面list
app啟動(dòng)性能指標(biāo)
冷啟動(dòng)(最重要)
時(shí)間:從application onCreate到displayed time之間
通俗含義:app沒有啟動(dòng)或app進(jìn)程被殺
暖啟動(dòng)
app已經(jīng)啟動(dòng)了,但是很久沒有使用,手機(jī)內(nèi)存把a(bǔ)pp進(jìn)程殺掉,但對象還在保留
熱啟動(dòng)
app進(jìn)程在后臺(tái),沒有被內(nèi)存殺掉,進(jìn)入app時(shí)只是把后臺(tái)帶到前臺(tái)給用戶展示
首屏啟動(dòng)(好像沒有這個(gè))
百度了很久好像都沒這個(gè)東西,估計(jì)是指打開之后有一個(gè)廣告的展示?
建議時(shí)間(不是特別標(biāo)準(zhǔn),了解即可)
冷啟動(dòng)5秒
暖啟動(dòng)2秒
熱啟動(dòng)1.5秒
app啟動(dòng)時(shí)間測試方法以及工具
adb logcat(時(shí)間不太準(zhǔn)確)
原因:空白頁、廣告時(shí)間,動(dòng)態(tài)加載其實(shí)adb logcat都無法記錄,只有一個(gè)主“頁面”或者進(jìn)入其他頁面之后的時(shí)間
錄屏+視頻拆幀(最準(zhǔn)確)
uiautomator等自動(dòng)化工具200ms
traceview
硬埋點(diǎn)(不同硬件之間,一個(gè)統(tǒng)一測試啟動(dòng)時(shí)間的方法)
adb logcat
操作步驟
清理緩存數(shù)據(jù):adb shell pm clear package
停止進(jìn)程:adb shell am force-stop package
啟動(dòng)app:adb shell am start -S -W package/activty
獲取數(shù)據(jù):adb logcat | grep -i displayed
結(jié)果
startTime:記錄剛準(zhǔn)備調(diào)用stratActivityAndWait()的時(shí)間點(diǎn)
endTime:記錄stratActivityAndWait()函數(shù)調(diào)用返回的時(shí)間點(diǎn)
WaitTime:stratActivityAndWait()的調(diào)用耗時(shí)
WaitTime=endTime-startTime
實(shí)戰(zhàn)
記錄雪球的啟動(dòng)時(shí)間
C:\Users\user>adb shell pm clear com.xueqiu.android
Success
C:\Users\user>adb shell am force-stop com.xueqiu.android
-W: wait for launch to complete
-S: force stop the target app before starting the activity
C:\Users\user>adb shell am start -S -W com.xueqiu.android/.view.WelcomeActivityAlias
Stopping: com.xueqiu.android
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.xueqiu.android/.view.WelcomeActivityAlias }
Status: ok
Activity: com.xueqiu.android/.view.WelcomeActivityAlias
ThisTime: 1063
TotalTime: 1063
WaitTime: 1111
Complete
C:\Users\user>adb logcat | grep -i displayed
05-03 05:06:19.698 951 986 I ActivityManager: Displayed com.xueqiu.trade.android/com.xueqiu.android.base.h5.H5Activity: +490ms
05-03 05:08:00.489 951 986 I ActivityManager: Displayed com.xueqiu.android/.common.search.USearchActivity: +214ms
05-03 05:10:00.307 951 986 I ActivityManager: Displayed com.xueqiu.android/.view.WelcomeActivityAlias: +1s63ms
05-03 05:10:02.058 951 986 I ActivityManager: Displayed com.xueqiu.android/.common.MainActivity: +590ms
05-03 05:10:06.771 951 986 I ActivityManager: Displayed com.xueqiu.android/.common.UpdateDialogActivity: +105ms
05-03 05:11:19.856 951 986 I ActivityManager: Displayed com.xueqiu.android/.view.WelcomeActivityAlias: +728ms
05-03 05:11:21.266 951 986 I ActivityManager: Displayed com.xueqiu.android/.common.MainActivity: +955ms
使用ffmpeg拆針
操作步驟
要先吧ffmpeg的程序下載了,然后配置環(huán)境變量,請?jiān)诠倬W(wǎng)下載windows的版本吧,環(huán)境配置特別簡單
清除app的緩存:adb shell pm clear package
強(qiáng)制停止app的進(jìn)程,處于冷啟動(dòng)的狀態(tài)adb shell am force-stop package
錄制一個(gè)時(shí)間為30秒的視頻,并保存在sdcard中:adb shell screenrecord --bugreport --time-limit 30 /sdcard/1.mp4 &
啟動(dòng)app:adb shell am start -S -W package/activity
把文件pull到當(dāng)前文件夾:adb pull /sdcard/1.mp4 .
把錄制的視頻轉(zhuǎn)化成gif,感覺沒卵用:ffmpeg -i 1.mp4 xueqiu.gif
ffmpeg -i 1.mp4 -r 10 frames_%03d.jpg
-i后面跟要處理的視頻文件
-r表示一秒要拆多少幀,如果是30秒的視頻,就會(huì)拆成300張圖片
%03d表示文件從001開始,到最后的300
把1.mp4的視頻拆成300張圖片,一張圖片的時(shí)間為0.1秒
==注意:使用方法7時(shí),盡量把視頻放在一個(gè)文件夾里面==
實(shí)操
C:\Users\user>adb shell pm clear com.xueqiu.android
Success
C:\Users\user>adb shell am force-stop com.xueqiu.android
C:\Users\user>adb shell am start -S -W com.xueqiu.android/.view.WelcomeActivityAlias
Stopping: com.xueqiu.android
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.xueqiu.android/.view.WelcomeActivityAlias }
Status: ok
Activity: com.xueqiu.android/.view.WelcomeActivityAlias
ThisTime: 1063
TotalTime: 1063
WaitTime: 1111
Complete
C:\Users\user>adb pull /sdcard/1.mp4 .
C:\Users\user>ffmpeg -i 1.mp4 -r 10 frames_%03d.jpg
(文章來源于霍格沃茲測試學(xué)院) 更多技術(shù)文章可點(diǎn)擊http://qrcode.testing-studio.com/f?from=jianshu&url=https://ceshiren.com/t/topic/3822