Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.mapyo:aws-device-farm-gradle-plugin:'
}
dependencies {
implementation("com.github.mapyo:aws-device-farm-gradle-plugin:")
}
<dependency>
<groupId>com.github.mapyo</groupId>
<artifactId>aws-device-farm-gradle-plugin</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.mapyo" % "aws-device-farm-gradle-plugin" % ""
:dependencies [[com.github.mapyo/aws-device-farm-gradle-plugin ""]]
AWS Device Farm integration with Android Gradle Build system
This plugin provides [AWS Device Farm] (http:// aws.amazon.com/device-farm) functionality from your Android gradle environment, allowing you to kick off tests on real Android phones and tablets hosted in the AWS Cloud.
For more information see [AWS Device Farm Developer Guide] (http:// docs.aws.amazon.com/devicefarm/latest/developerguide/welcome.html)
Building the plugin is optional. The plugin is published through Maven Central. If you wish to allow gradle to download the plugin directly skip this section and jump to Using the plugin
gradle install
. buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.0'
}
}
apply plugin: 'devicefarm'
devicefarm {
projectName "My Project" // required: Must already exists.
devicePool "My Device Pool Name" // optional: Defaults to "Top Devices"
runName "My Run" // optional: Defaults to "${appName}-${buildVariant}.apk (Gradle)"
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")
}
}
gradle devicefarmUpload
) {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DeviceFarmAll",
"Effect": "Allow",
"Action": [ "devicefarm:*" ],
"Resource": [ "*" ]
}
]
}
Device Farm provides support for Appium Java TestNG and JUnit for Android.
You can choose to useTestNG()
or useJUnit()
JUnit is the default and does not need to be explicitly specified.
appium {
tests file("path to zip file") // required
useTestNG() // or useJUnit()
}
Use AWS Device Farm's app explorer to test user flows through your app without writing custom test scripts. A username and password may be specified in the event your app requires account log-in.
appexplorer {
username "my-username"
password "my-password"
}
Device Farm provides a built-in fuzz test type.
The built-in fuzz test randomly sends user interface events to devices and then reports results.
fuzz {
eventThrottle 50 // optional default
eventCount 6000 // optional default
randomizerSeed 1234 // optional default blank
}
Device Farm provides support for Calabash for Android.
calabash {
tests file("path to zip file") // required
tags "my tags" // optional calabash tags
profile "my profile" // optional calabash profile
}
Device Farm provides support for Instrumentation (JUnit, Espresso, Robotium, or any Instrumentation-based tests) for Android.
When running an instrumentation test in gradle the apk generated from your androidTest directory will be used as the source of your tests.
instrumentation {
filter "test filter per developer docs" // optional
}
Upload your app as well as your UI Automator based tests packaged in a jar file
uiautomator {
tests file("path to uiautomator jar file") // required
filter "test filter per developer docs" // optional
}
As Device Farm supports additional test types the plugin must be extended to enable them into the DSL.
void mynewtesttype(final Closure closure) {
NewTestType newTest = new NewTestType()
project.configure newTest, closure
test = newTest
}