com.amazonaws.services.devicefarm.model.ScheduleRunTest Java Examples

The following examples show how to use com.amazonaws.services.devicefarm.model.ScheduleRunTest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AWSDeviceFarm.java    From aws-device-farm-jenkins-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Schedule a test run on Device Farm.
 *
 * @param projectArn    The ARN of the Device Farm project to run the test on.
 * @param name          The name of the test run.
 * @param appArn        The ARN of the app to test.
 * @param devicePoolArn The ARN of the device pool to test against.
 * @param test          The run test.
 * @param configuration The run configuration.
 * @return The result of the schedle run.
 */
public ScheduleRunResult scheduleRun(String projectArn,
                                     String name,
                                     String appArn,
                                     String devicePoolArn,
                                     ScheduleRunTest test,
                                     Integer jobTimeoutMinutes,
                                     ScheduleRunConfiguration configuration,
                                     Boolean videoCapture,
                                     Boolean skipAppResign) {
    ScheduleRunRequest request = new ScheduleRunRequest()
            .withProjectArn(projectArn)
            .withName(name)
            .withDevicePoolArn(devicePoolArn)
            .withTest(test);

    ExecutionConfiguration exeConfiguration = new ExecutionConfiguration();
    if (!jobTimeoutMinutes.equals(DEFAULT_JOB_TIMEOUT_MINUTE)) {
        exeConfiguration.setJobTimeoutMinutes(jobTimeoutMinutes);
    }
    exeConfiguration.setVideoCapture(videoCapture);
    exeConfiguration.setSkipAppResign(skipAppResign);
    request.withExecutionConfiguration(exeConfiguration);

    if (configuration != null) {
        request.withConfiguration(configuration);
    }

    if (appArn != null) {
        request.withAppArn(appArn);
    }

    return api.scheduleRun(request);
}
 
Example #2
Source File: DeviceFarmServer.java    From aws-device-farm-gradle-plugin with Apache License 2.0 4 votes vote down vote up
/**
 * Upload and test the newly built apk.
 *
 * @param variantName variant of the latest build. Ex: 'debug'
 * @param testPackage File object to the newly built APK which contains tests
 * @param testedApk   File object to the newly built application APK
 */
@Override
public void uploadApks(final String variantName, final File testPackage, final File testedApk) {
    final Project project = utils.findProjectByName(extension.getProjectName());
    logger.lifecycle(String.format("Using Project \"%s\", \"%s\"", project.getName(), project.getArn()));

    final DevicePool devicePool = utils.findDevicePoolByName(project, extension.getDevicePool());
    logger.lifecycle(String.format("Using Device Pool \"%s\", \"%s\"", devicePool.getName(), devicePool.getArn()));

    final String appArn = uploader.upload(testedApk == null ? testPackage : testedApk, project, UploadType.ANDROID_APP).getArn();
    logger.lifecycle(String.format("Will test app in  \"%s\", \"%s\"", testedApk == null ? testPackage.getName() : testedApk.getName(), appArn));

    final Collection<Upload> auxApps = uploadAuxApps(project);

    final String extraDataArn = uploadExtraDataZip(project);

    // For few frameworks , you can specify a testSpec
    final Upload testSpec = utils.findTestSpecByName(extension.getTest().getTestSpecName(), project);
    if (testSpec != null) {
        logger.lifecycle(String.format("Using  TestSpec \"%s\", \"%s\"", testSpec.getName(), testSpec.getArn()));
    }

    final ScheduleRunTest runTest = new ScheduleRunTest()
            .withParameters(extension.getTest().getTestParameters())
            .withType(extension.getTest().getTestType())
            .withFilter(extension.getTest().getFilter())
            .withTestPackageArn(uploadTestPackageIfNeeded(project, testPackage))
            .withTestSpecArn(testSpec == null ? null: testSpec.getArn());


    runTest.addParametersEntry(RUNPARAM_APP_PERF_MONITORING, Boolean.toString(extension.getPerformanceMonitoring()));

    final ExecutionConfiguration executionConfiguration = new ExecutionConfiguration()
            .withJobTimeoutMinutes(extension.getExecutionTimeoutMinutes())
            .withVideoCapture(extension.getVideoRecording());

    final ScheduleRunConfiguration configuration = new ScheduleRunConfiguration()
            .withAuxiliaryApps(getAuxAppArns(auxApps))
            .withExtraDataPackageArn(extraDataArn)
            .withLocale(extension.getDeviceState().getLocale().toString())
            .withLocation(extension.getDeviceState().getLocation())
            .withBillingMethod(extension.isMetered() ? BillingMethod.METERED : BillingMethod.UNMETERED)
            .withRadios(extension.getDeviceState().getRadios());

    final ScheduleRunRequest request = new ScheduleRunRequest()
            .withAppArn(appArn)
            .withConfiguration(configuration)
            .withDevicePoolArn(devicePool.getArn())
            .withProjectArn(project.getArn())
            .withTest(runTest)
            .withExecutionConfiguration(executionConfiguration)
            .withName(String.format("%s (Gradle)", testedApk == null ? testPackage.getName() : testedApk.getName()));

    final ScheduleRunResult response = api.scheduleRun(request);

    logger.lifecycle(String.format("View the %s run in the AWS Device Farm Console: %s",
            runTest.getType(), utils.getRunUrlFromArn(response.getRun().getArn())));
}