Android App Stress Test (iii) Monkey log automatic analysis script
Objective
last said to share monkey log Analysis script, this time paste out share, nonsense not to say, please look at the text.
Directory
1. Monkey Log Analysis Script
2. Script principle
3. Operation Example
1. Monkey Log Analysis Script
1), script file:monkey_log analysis. bat
@ECHO OFF
ECHO. :: :::::::::::::::::::::::::::::::::::::::::::::::
ECHO. :: Analyze Monkey logs::
ECHO. :: findyou::
ECHO. :: version V1.0.1::
ECHO. :: Time: 2014.08.26::
ECHO. :: :::::::::::::::::::::::::::::::::::::::::::::::
REM method One: Manually set the monkey log path
SETMonkeylogfile=f:\monkey\20140808\findyouv1.0.0\20140825181801_monkey.log
REM Method Two: Drag the Monkey log directly onto this bat file
IF not"%1" = = "" SETmonkeylogfile= %1
ECHO. [INFO] Monkey log:%monkeylogfile%
ECHO. [INFO] Start analysis
SETBlnexception=0
ECHO.
ECHO.
REM If you feel that the analysis is too fast, there is no feeling, the following comments removed from the fake analysis, there is a sense of pause
REM ping-n 2 127.0.0.1>nul
:: ANR Log
for/F "delims="%%a in (' findstr/c: "ANR"%monkeylogfile% ') Do(
SETStranr=%%a
)
:: Crash Log
for/F "delims="%%a in (' findstr/c: "CRASH"%monkeylogfile% ') Do(
SETStrcrash=%%a
)
:: Exception Log
for/F "delims="%%a in (' findstr/c: "Exception"%monkeylogfile% ') Do(
SETStrexception=%%a
)
:: Normal
for/F "delims="%%a in (' findstr/c: "Monkey finished"%monkeylogfile% ') Do(
SETStrfinished=%%a
)
IF not"%stranr%" = = "" (
ECHO. [INFO] Analysis Monkey log exists: ANR
ECHO. [INFO]------------------------------------
ECHO. "%stranr%"
SET/A Blnexception+=1
ECHO.
)
IF not"%strcrash%" = = "" (
ECHO. [INFO] Analysis Monkey log exists: CRASH
ECHO. [INFO]------------------------------------
ECHO. "%strcrash%"
SET/A Blnexception+=1
ECHO.
)
IF not"%strexception%" = = "" (
ECHO. [INFO] Parsing Monkey log presence: exception
ECHO. [INFO]------------------------------------
ECHO. "%strexception%"
SET/A Blnexception+=1
)
IF not"%strfinished%" = = "" (
ECHO. [INFO] Analysis Monkey log exists: Execute Success Token
ECHO. [INFO]------------------------------------
ECHO. "%strfinished%"
ECHO.
) ELSE(
IF%blnexception% EQU 0 ECHO. [INFO] Parsing monkey log results: Monkey perform an abnormal interrupt, please re-execute the monkey script!
ECHO.
)
REM if Blnexception is not 0, indicate an exception, change the font to Lavender
IF%blnexception% NEQ 0 (
Color 0D
ECHO. [INFO] Analysis Monkey Log results: There is an exception log, please hand again carefully check!
ECHO.
) ELSE(
ECHO. [INFO] Analysis Monkey log results: normal
ECHO.
)
ECHO.
ECHO. [ EXIT] Press any key to close the window ...
PAUSE>nul
2), "Use method" A, save script: Monkey_log analysis. BATB, Execute script: Method One: Manually set Monkey log path, modify Monkeyfile variable in script
Method Two: Drag the monkey log directly onto the bat file
★ Warm Tips ★
*, please check the results by hand on a regular basis
2. Script principle
1), Monkey results analysis theory:
A. See section 4th of the first "Android app stress test (i) Monkey tool Introduction" In this series : Monkey test Results Analysis
2), Script core idea:
A, theoretical support, see above 1)
B, search keywords
c, through the keyword to interpret if there is no exception
★ Warm Tips ★
*, insufficient, if the monkey command has debugging options such as:--ignore-crashes--ignore-timeouts, this script also needs to increase the judging conditions, if interested can optimize their own enhancements.
3. Operation Record
1), drag the monkey log to the bat file
2), script execution results
A, normal
B, exception
Android App Stress Test (iii) Monkey log automatic analysis script