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
-
Add the plugin artifact to your dependency list in
build.gradle.Copybuildscript { repositories { mavenLocal() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.0' } } -
Configure the plugin in your
build.gradlefile. The following test specific configuration should serve as your guide:Copyapply plugin: 'devicefarm' devicefarm { projectName "My Project" // required: Must already exists. devicePool "My Device Pool Name" // optional: Defaults to "Top Devices" useUnmeteredDevices() // optional if you wish to use your un-metered devices authentication { accessKey "aws-iam-user-accesskey" secretKey "aws-iam-user-secretkey" // or roleArn "My role arn" // Optional, if role arn is specified, it will be used. // Otherwise use access and secret keys } // optional block, radios default to 'on' state, all parameters optional devicestate { extraDataZipFile file("relative/path/to/zip") // default null auxiliaryApps [file("path1"), file("path2")] // default empty list wifi on bluetooth off gps off nfc on latitude 47.6204 // default longitude -122.3491 // default } // Configure test type, if none default to instrumentation // Fuzz // fuzz { } // Instrumentation // See AWS Developer docs for filter (optional) // instrumentation { filter "my-filter" } // Calabash calabash { tests file("path-to-features.zip") } } -
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



