最近在学习
http://developer.android.com/tools/testing/testing_ui.html
测试软件:盛大 有你
我的测试代码如下:
package com.snda.youni;

import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiSelector;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;

public class OpenYouni extends UiAutomatorTestCase{
public void OpenYouniFirst() throws UiObjectNotFoundException {
getUiDevice().pressHome();

UiObject youniBtn = new UiObject(new UiSelector().index(3) .className(android.view.View.class.getName()));
youniBtn.clickAndWaitForNewWindow();

UiObject socialNet = new UiObject(new UiSelector().text("社交圈"));
socialNet.click();

}
}
执行测试的结果是:
haohuiyan@haohuiyan:~/Documents/workspace/TestYouni/bin$adb shell uiautomator runtest TestYouni.jar -c com.snda.youni.OpenYouni
INSTRUMENTATION_STATUS: stream=
Test results for UiAutomatorTestRunner=
Time: 0.0

OK (0 tests)

INSTRUMENTATION_STATUS_CODE: -1
感觉完全没有执行,我就觉得是我的代码的问题,有你这个软件里面没有 android:hint 也没有 android:contentDescription,我就用了 index,好像不管用。求教


↙↙↙阅读原文可查看相关链接,并与作者交流