Step 2: Setting up the AWS Device Farm Gradle Plugin - AWS Device Farm

Step 2: Setting up the AWS Device Farm Gradle Plugin

If you haven't done so already, clone the repository and install the plugin using the procedure here: Building the Device Farm Gradle Plugin.

To configure the AWS Device Farm Gradle Plugin

  1. Add the plugin artifact to your dependency list in build.gradle.

    buildscript { repositories { mavenLocal() mavenCentral() } dependencies { classpath '' classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.0' } }
  2. Configure the plugin in your build.gradle file. The following test specific configuration should serve as your guide:

    apply plugin: 'devicefarm' devicefarm { // Required. The project must already exist. You can create a project in the AWS Device Farm console. projectName "My Project" // required: Must already exist. // Optional. Defaults to "Top Devices" // devicePool "My Device Pool Name" // Optional. Default is 150 minutes // executionTimeoutMinutes 150 // Optional. Set to "off" if you want to disable device video recording during a run. Default is "on" // videoRecording "on" // Optional. Set to "off" if you want to disable device performance monitoring during a run. Default is "on" // performanceMonitoring "on" // Optional. Add this if you have a subscription and want to use your unmetered slots // useUnmeteredDevices() // Required. You must specify either accessKey and secretKey OR roleArn. roleArn takes precedence. authentication { accessKey "AKIAIOSFODNN7EXAMPLE" secretKey "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" // OR roleArn "arn:aws:iam::111122223333:role/DeviceFarmRole" } // Optionally, you can // - enable or disable Wi-Fi, Bluetooth, GPS, NFC radios // - set the GPS coordinates // - specify files and applications that must be on the device when your test runs devicestate { // Extra files to include on the device. // extraDataZipFile file("path/to/zip") // Other applications that must be installed in addition to yours. // auxiliaryApps files(file("path/to/app"), file("path/to/app2")) // By default, Wi-Fi, Bluetooth, GPS, and NFC are turned on. // wifi "off" // bluetooth "off" // gps "off" // nfc "off" // You can specify GPS location. By default, this location is 47.6204, -122.3491 // latitude 44.97005 // longitude -93.28872 } // By default, the Instrumentation test is used. // If you want to use a different test type, configure it here. // You can set only one test type (for example, Calabash, Fuzz, and so on) // Fuzz // fuzz { } // Calabash // calabash { tests file("") } }
  3. Run your Device Farm test using the following task: gradle devicefarmUpload.

    The build output will print out a link to the Device Farm console where you can monitor your test execution.

Next step: Generating an IAM user