Java Code Examples for com.android.tradefed.testtype.InstrumentationTest

Following code examples demonstrate how to use com.android.tradefed.testtype.InstrumentationTestfrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.android.tradefed.testtype.InstrumentationTestand various code implementation of this class.

    
    public static void collectDeviceInfo(ITestDevice device, File testApkDir,
            ITestInvocationListener listener) throws DeviceNotAvailableException {
        File apkFile = new File(testApkDir, String.format("%s.apk", APK_NAME));
        if (!apkFile.exists()) {
            Log.e(LOG_TAG, String.format("Could not find %s", apkFile.getAbsolutePath()));
        }
        InstrumentationTest instrTest = new InstrumentationTest();
        instrTest.setDevice(device);
        instrTest.setInstallFile(apkFile);
        instrTest.setRerunMode(false);
        instrTest.setPackageName(APP_PACKAGE_NAME);
        instrTest.setRunnerName(INSTRUMENTATION_NAME);
        instrTest.run(listener);
    } 


Advertisement
Javadoc
A Test that runs an instrumentation test package on given device.
Advertisement