Project team Recently, we plan to do some special tests on Android client applications to evaluate them. Through various queries and understanding, we found that the APP is stable The magic tool of sex testing -- Monkey. The following is a simple record of Monkey's application.
Install Android sdk
Run cmd
View the exported file. There are no crash and anr error messages in this file:
During the Monkey test, program crash (CRASH) and program unresponsiveness (ANR) may occur. The log information of the test should be obtained to solve the bug.
When a crash occurs during the test, the bug is reproduced according to the seed value:
adb Shell monkey - p (package name) - s (seed value) - v 1000
Appears during the test
ANR
Phenomenon, corresponding information will be output to
ANR
open
head
,
Obtained
Get information
enter
that 's ok
problem
The same as
kind
Can be connected
too
seed
come
enter
Reply
present
adb
shell cd /data/
anr
cut
change
reach
equipment
Under the path
ls
You can see
traces.txt
Inside
by
log
Information.
monkeyscript
It is the script language of Monkey, a set of commands that can be recognized by Monkey, and can help us complete a series of fixed repetitive operations. Monkey tests through scripts, but it is just a notepad file. The disadvantage is that there is no logic in coordinates, keys, etc.
The following is an introduction to common APIs:
Complete the writing of the monkey.txt script, save it to a path, switch to the monkey.txt path adb push monkey.txt/data/local/temp/(any path of the device, not specified), switch to the device cd/data/local/temp switch to the monkey.txt path, and monkey-f monkey.txt - v 10 execute the monkey.txt script and the number of executions. Complete the automated Monkey test of MonkeyScript.
Sogou test WeChat signal: Qa_xiaoming
Sogou test QQ fan group: 459645679
This article is shared from the WeChat official account Sogou QA.
In case of infringement, please contact support@oschina.cn Delete.
Participation in this article“ OSC Source Innovation Plan ”, welcome you to join us and share with us.