monkey 压力测试
参考网址:http://developer.android.com/tools/help/monkey.html
adb shell monkey -p your.package.name -v 500
robotium 自动化测试
下载地址:http://code.google.com/p/robotium/downloads/list
测试源程序为应用程序管理器(代码略)
示例代码如下:
package com.example.appexplore.test;
import com.example.appexplore.MainActivity;
import com.jayway.android.robotium.solo.Solo;
import android.test.ActivityInstrumentationTestCase2;
public class UITest extends ActivityInstrumentationTestCase2<MainActivity> {
private Solo solo;
public UITest() {
super("com.example.appexplore", MainActivity.class);
}
public void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
/**
*测试界面中是否有qq和智联招聘这两个应用
public void testUI() throws Exception {
boolean expected = true;
boolean actual = solo.searchText("QQ") && solo.searchText("智联聘");
assertEquals("this and/or is are not found", expected, actual);
}
}