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

The following examples show how to use com.amazonaws.services.devicefarm.model.ExecutionConfiguration. 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: TestConfigurationFactoryTest.java    From justtestlah with Apache License 2.0 6 votes vote down vote up
@Test
public void testExecutionConfigurationTestTrue() {
  Properties props = new Properties();
  props.put("aws.accountsCleanUp", "true");
  props.put("aws.appPackagesCleanUp", "true");
  props.put("aws.jobTimeout", "10");
  props.put("aws.skipAppResign", "true");
  ReflectionTestUtils.setField(properties, "props", props);
  target = new TestConfigurationFactory(properties);

  ExecutionConfiguration executionConfiguration = target.getExecutionConfiguration();
  assertThat(executionConfiguration.getAccountsCleanup())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.accountsCleanUp")));
  assertThat(executionConfiguration.getAppPackagesCleanup())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.appPackagesCleanUp")));
  assertThat(executionConfiguration.getJobTimeoutMinutes())
      .isEqualTo(Integer.parseInt(props.getProperty("aws.jobTimeout")));
  assertThat(executionConfiguration.getSkipAppResign())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.skipAppResign")));
}
 
Example #2
Source File: TestConfigurationFactoryTest.java    From justtestlah with Apache License 2.0 6 votes vote down vote up
@Test
public void testExecutionConfigurationTestRandom() {
  Properties props = new Properties();
  props.put("aws.accountsCleanUp", Boolean.toString(RandomUtils.nextBoolean()));
  props.put("aws.appPackagesCleanUp", Boolean.toString(RandomUtils.nextBoolean()));
  props.put("aws.jobTimeout", Integer.toString(RandomUtils.nextInt()));
  props.put("aws.skipAppResign", Boolean.toString(RandomUtils.nextBoolean()));
  ReflectionTestUtils.setField(properties, "props", props);
  target = new TestConfigurationFactory(properties);

  ExecutionConfiguration executionConfiguration = target.getExecutionConfiguration();
  assertThat(executionConfiguration.getAccountsCleanup())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.accountsCleanUp")));
  assertThat(executionConfiguration.getAppPackagesCleanup())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.appPackagesCleanUp")));
  assertThat(executionConfiguration.getJobTimeoutMinutes())
      .isEqualTo(Integer.parseInt(props.getProperty("aws.jobTimeout")));
  assertThat(executionConfiguration.getSkipAppResign())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.skipAppResign")));
}
 
Example #3
Source File: TestConfigurationFactoryTest.java    From justtestlah with Apache License 2.0 6 votes vote down vote up
@Test
public void testExecutionConfigurationTestFalse() {
  Properties props = new Properties();
  props.put("aws.accountsCleanUp", "false");
  props.put("aws.appPackagesCleanUp", "false");
  props.put("aws.skipAppResign", "false");
  ReflectionTestUtils.setField(properties, "props", props);
  target = new TestConfigurationFactory(properties);

  ExecutionConfiguration executionConfiguration = target.getExecutionConfiguration();
  assertThat(executionConfiguration.getAccountsCleanup())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.accountsCleanUp")));
  assertThat(executionConfiguration.getAppPackagesCleanup())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.appPackagesCleanUp")));
  assertThat(executionConfiguration.getSkipAppResign())
      .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.skipAppResign")));
}
 
Example #4
Source File: TestConfigurationFactory.java    From justtestlah with Apache License 2.0 5 votes vote down vote up
public ExecutionConfiguration getExecutionConfiguration() {
  ExecutionConfiguration executionConfiguration = new ExecutionConfiguration();
  executionConfiguration.setAccountsCleanup(
      Boolean.parseBoolean(properties.getProperty("aws.accountsCleanUp", "true")));
  executionConfiguration.setAppPackagesCleanup(
      Boolean.parseBoolean(properties.getProperty("aws.appPackagesCleanUp", "true")));
  executionConfiguration.setJobTimeoutMinutes(
      Integer.parseInt(properties.getProperty("aws.jobTimeout", "10")));
  executionConfiguration.setSkipAppResign(
      Boolean.parseBoolean(properties.getProperty("aws.skipAppResign", "false")));
  return executionConfiguration;
}
 
Example #5
Source File: TestConfigurationFactoryTest.java    From justtestlah with Apache License 2.0 5 votes vote down vote up
@Test
public void testExecutionConfigurationTestDefaults() {
  Properties props = new Properties();
  ReflectionTestUtils.setField(properties, "props", props);
  target = new TestConfigurationFactory(properties);

  ExecutionConfiguration executionConfiguration = target.getExecutionConfiguration();
  assertThat(executionConfiguration.getAccountsCleanup()).isEqualTo(true);
  assertThat(executionConfiguration.getAppPackagesCleanup()).isEqualTo(true);
  assertThat(executionConfiguration.getJobTimeoutMinutes()).isEqualTo(10);
  assertThat(executionConfiguration.getSkipAppResign()).isEqualTo(false);
}
 
Example #6
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 #7
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())));
}