/** {@inheritDoc} */ @Override public void run(ITestInvocationListener listener) throws DeviceNotAvailableException { Assert.assertNotNull(mTestDevice); mAppListPath = new File(mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE), APP_LIST_FILE) .getAbsolutePath(); mAppOutputPath = new File(mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE), APP_OUTPUT_FILE) .getAbsolutePath(); setupAppInfos(); // Setup the device mTestDevice.executeShellCommand(String.format("rm %s %s", mAppListPath, mAppOutputPath)); mTestDevice.pushString(generateAppList(), mAppListPath); mTestDevice.executeShellCommand(String.format("chmod 750 %s", APP_LAUNCH)); // Sleep 30 seconds to let device settle. RunUtil.getDefault().sleep(30 * 1000); // Run the test String output = mTestDevice.executeShellCommand(APP_LAUNCH); CLog.d("App launch output: %s", output); logOutputFile(listener); }
/** * Wipes the device's external memory of test collateral from prior runs. * * @throws DeviceNotAvailableException If the device is unavailable or something happened while * deleting files */ private void preTestSetup() throws DeviceNotAvailableException { String extStore = mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE); mUrlsFilePath = String.format("%s/%s", extStore, URLS_FILE_NAME); mStatusFilePath = String.format("%s/%s", extStore, STATUS_FILE_NAME); if (!mTestDevice.doesFileExist(mUrlsFilePath)) { throw new RuntimeException("missing URL list file at: " + mUrlsFilePath); } mTestDevice.executeShellCommand("rm " + mStatusFilePath); }