安桌测试及自动化(monkey runner vs robotium)

Life is short , play more!
本文来自lihao's Blog,转载请注明。

Android sdk 自带monkey runner工具,可以用来模拟用户输入,并对屏幕截图. 对于UI测试来讲 ,很难用monkey runner. 我们无法判断UI的展现. 通过截图比对, 也可以实现UI的判断,但很容易出差错(比如有稍微的UI变化,但不等于都是错误).

below said by raki:

You might use Monkey to test that your app handles only certain
keystrokes, handles only keystrokes sent in a certain order, and
doesn’t crash if it gets anything else. For touch events, you could
use it to test that random touches or gestures don’t do something
unexpected in your application. As the Dev Guide topic says, Monkey is
for “stress-testing” your application.

MonkeyRunner provides limited scripting and control capabilities, so
that you can write Python scripts to run test suites. The Froyo Dev
Guide describes MonkeyRunner in some detail. You have to know Python
in order to use it. You can send keystrokes and touch events to
control the UI, but to send touch events you have to know the screen
coordinates where you want the touch to occur. That means that you’ll
need to do some work by hand first, to figure out those coordinates.
As far as I know, MonkeyRunner can’t do gestures.

Robotium is in Java only. It’s like JUnit. You write something that
looks like a Java program. The Robotium runner interprets it as a
sequence of steps to run. There’s documentation online.


发表评论

电子邮件地址不会被公开。 必填项已用*标注