アプリケーションの Robotium テスト ケースを作成しました。テストを開始するためにアプリを手動で操作する必要があるという事実を除いて、すべてがうまく機能します。つまり、アプリ内の別のアクティビティに移動する必要があり、その後テスト ケースが開始されます。何らかの理由で、起動時にテストが開始されません。
public class TestApk extends ActivityInstrumentationTestCase2{
private static final String TARGET_PACKAGE_ID= "com.bizzabo.client";
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME="com.bizzabo.client.ui.activities.BzLauncher";
private static Class launcherActivityClass;
static{
try
{
launcherActivityClass=Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e){
throw new RuntimeException(e);
}}
public TestApk()throws ClassNotFoundException{
super( launcherActivityClass);
}
private Solo solo;
@Override
protected void setUp() throws Exception
{
solo = new Solo(getInstrumentation(),getActivity());
}
public void testInformationMenu() {
final int INFORMATION_VIEW_NO = 11;
solo.getCurrentActivity();
solo.sleep(1000);
solo.goBack();
solo.sleep(1000);
ArrayList<View> viewList = solo.getCurrentViews();
solo.clickOnView(viewList.get(INFORMATION_VIEW_NO));
solo.sleep(1000);
solo.clickOnText("Add Event");
solo.sleep(1000);
solo.goBack();
solo.clickOnView(viewList.get(INFORMATION_VIEW_NO));
solo.clickOnText("Invite Your Friends");
solo.sleep(1000);
solo.goBack();
solo.clickOnView(viewList.get(10));
solo.sleep(1000);
solo.enterText(0, "testbot");
solo.sendKey(Solo.ENTER);
solo.sleep(5000);
solo.clickOnImage(2);
solo.sleep(1000);
solo.clickOnText("Join");
solo.goBack();
solo.clickOnText("Community");
solo.sleep(1000);
solo.clickOnText("Join");
solo.goBack();
solo.clickOnText("HERE NOW");
solo.sleep(1000);
solo.clickOnText("Check-In");
solo.sleep(1000);
solo.goBack();
solo.clickOnText("Opportunities");
solo.clickOnText("Messages");
solo.clickOnText("Offers");
solo.sleep(1000);
solo.clickOnText("Event");
solo.goBack();
solo.sleep(1000);
solo.clickOnText("Information");
solo.clickOnText("Join");
solo.goBack();
solo.clickOnText("+ Invite");
solo.goBack();
solo.clickOnText("Buzz");
solo.goBack();
solo.goBack();
solo.drag(400, 400, 400, 300, 1);
solo.sleep(1000);
}
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
}