当前位置: 首页>>代码示例>>Java>>正文


Java UiAutomatorTestCase类代码示例

本文整理汇总了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;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:19,代码来源:StartAction.java

示例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;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:19,代码来源:KeyAction.java

示例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;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:17,代码来源:ScenarioRunnerTest.java

示例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;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:15,代码来源:PressAction.java

示例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;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:10,代码来源:TempoAction.java

示例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;

}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:12,代码来源:AssertExistAction.java

示例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;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:14,代码来源:InputAction.java

示例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;

}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:8,代码来源:ScenarioRunner.java

示例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());
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:13,代码来源:SuperMockTest.java

示例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);

}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:8,代码来源:ActionImplTest.java

示例11: run

import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
    uiAutomatorTestCase.getUiDevice().pressHome();
    return null;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:6,代码来源:HomeAction.java

示例12: run

import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
    uiAutomatorTestCase.getUiDevice().pressBack();
    return null;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:6,代码来源:BackAction.java

示例13: run

import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
    throw new UnsupportedOperationException();

}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:6,代码来源:PlaneAction.java

示例14: run

import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
    return action.run(uiAutomatorTestCase, runtime);
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:4,代码来源:OptionalAction.java

示例15: run

import com.android.uiautomator.testrunner.UiAutomatorTestCase; //导入依赖的package包/类
@Override
public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) {
    return null;
}
 
开发者ID:fabricereix,项目名称:AndroidFunctionalTester,代码行数:5,代码来源:ScenarioRunnerTest.java


注:本文中的com.android.uiautomator.testrunner.UiAutomatorTestCase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。