本文整理汇总了Java中com.android.uiautomator.testrunner.UiAutomatorTestCase类的典型用法代码示例。如果您正苦于以下问题:Java UiAutomatorTestCase类的具体用法?Java UiAutomatorTestCase怎么用?Java UiAutomatorTestCase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UiAutomatorTestCase类属于com.android.uiautomator.testrunner包,在下文中一共展示了UiAutomatorTestCase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
try {
//ProcessBuilder pb = new ProcessBuilder("am start " + application);
ProcessBuilder pb = new ProcessBuilder("am", "start", application);
Process p = pb.start();
String error = getString(p.getErrorStream());
if (!error.isEmpty() && error.startsWith("Error")) {
return error;
}
} catch (IOException e) {
return e.getMessage();
}
return null;
}
示例2: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
try {
//ProcessBuilder pb = new ProcessBuilder("am start " + application);
ProcessBuilder pb = new ProcessBuilder("input", "keyevent", key);
Process p = pb.start();
String error = getString(p.getErrorStream());
if (!error.isEmpty() && error.startsWith("Error")) {
return error;
}
} catch (IOException e) {
return e.getMessage();
}
return null;
}
示例3: getScenarioRunner
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
private ScenarioRunner getScenarioRunner(Scenario scenario) {
ScenarioParser scenarioParser = mock(ScenarioParser.class);
try {
when((scenarioParser.parse(any(Reader.class)))).thenReturn(scenario);
} catch (ScenarioParsingException e) {
e.printStackTrace();
}
UiAutomatorTestCase uiAutomatorTestCase = mock(UiAutomatorTestCase.class);
UiDevice uiDevice = mock(UiDevice.class);
when(uiAutomatorTestCase.getUiDevice()).thenReturn(uiDevice);
ScenarioRunner runner = new ScenarioRunner(uiAutomatorTestCase, null, false, OUTPUT_DIR);
runner.setScenarioParser(scenarioParser);
return runner;
}
示例4: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
UiObject uiObject = getUiObject(description);
if (uiObject == null) {
return "UI Object '" + description + "' not found";
}
try {
uiObject.click();
} catch (UiObjectNotFoundException e) {
e.printStackTrace();
}
return null;
}
示例5: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
try {
Thread.sleep(duration);
} catch (InterruptedException e) {
e.printStackTrace();
}
return null;
}
示例6: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
// Find a specific String in the screen
UiObject uiObject = new UiObject(new UiSelector().textContains(value));
if (!uiObject.exists()) {
return "value " + value + " not found";
}
return null;
}
示例7: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
// TODO use both content-description and text
//UiObject uiObject = new UiObject(new UiSelector().descriptionContains(description));
UiObject uiObject = new UiObject(new UiSelector().textContains(description));
try {
uiObject.setText(value);
} catch (UiObjectNotFoundException e) {
e.printStackTrace();
return e.getMessage();
}
return null;
}
示例8: ScenarioRunner
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
public ScenarioRunner(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime, boolean deviceRooted, File outputDir) {
this.uiAutomatorTestCase = uiAutomatorTestCase;
this.runtime = runtime;
this.deviceRooted = deviceRooted;
this.outputDir = outputDir;
}
示例9: testBasic
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Test
public void testBasic() throws ScenarioParsingException, ActionParseException {
PowerMockito.mockStatic(ActionParser.class);
Mockito.when(ActionParser.parseAction(Mockito.any(String.class))).thenReturn(new Action("TEST", false, null, null, null) {
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
return null;
}
});
Assert.assertEquals("TEST", ActionParser.parseAction(null).toString());
}
示例10: setup
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Before
public void setup() {
UiAutomatorTestCase uiAutomatorTestCase = mock(UiAutomatorTestCase.class);
UiDevice uiDevice = mock(UiDevice.class);
when(uiAutomatorTestCase.getUiDevice()).thenReturn(uiDevice);
}
示例11: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
uiAutomatorTestCase.getUiDevice().pressHome();
return null;
}
示例12: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
uiAutomatorTestCase.getUiDevice().pressBack();
return null;
}
示例13: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
throw new UnsupportedOperationException();
}
示例14: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
return action.run(uiAutomatorTestCase, runtime);
}
示例15: run
import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
return null;
}