Robotium学习笔记一

一、 重签名问题
1、从手机Pull所需的apk通过压缩工具删除META-INF目录
2、通过以下命令行进行签名
>jarsigner -keystore "C:\Documents and Settings\ey\.android\debug.keystore" -storepass android -keypass android D:\Mms.apk androiddebugkey
>zipalign 4 D:\Mms.apk D:\debug\Mms.apk
 
3、Push签名后的文件到手机上
二、只有APK程序的测试
Demo如下
package com.phone.test;


import com.jayway.android.robotium.solo.Solo;


import android.annotation.SuppressLint;
import android.test.ActivityInstrumentationTestCase2;


public class CallTest extends ActivityInstrumentationTestCase2 {


private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.android.mms.ui.ConversationList";
private static String PACKAGENAME = "com.android.mms";





private static Class<?> launcherActivityClass;
static {
try {
launcherActivityClass = Class
.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}


@SuppressWarnings("unchecked")
public CallTest() throws ClassNotFoundException {
super(PACKAGENAME,launcherActivityClass);
}


private Solo solo;


@Override
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}


public void testSms() {
solo.clickOnText("新信息");
solo.typeText(0, "10086");
solo.sleep(2000);
solo.clickOnEditText(1);
solo.sleep(500);
solo.goBack();
solo.typeText(1, "test");
solo.sleep(2000);
solo.typeText(1, "test");
solo.sleep(1000);
solo.clickOnButton("发送");
solo.sleep(2000);
}


@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();


}


}
存在以下问题
 TypeText无法输入内容,正在查找解决办法。

posted on 2013-10-09 18:38  you Richer  阅读(176)  评论(0编辑  收藏  举报