在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):awslabs/aws-device-farm-gradle-plugin开源软件地址(OpenSource Url):https://github.com/awslabs/aws-device-farm-gradle-plugin开源编程语言(OpenSource Language):Java 58.2%开源软件介绍(OpenSource Introduction):AWS Device Farm Gradle PluginAWS Device Farm integration with the Android Gradle Build system This plugin provides AWS 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 the AWS Device Farm Developer Guide. Usage
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.3'
}
}
Minimal configurationThis will do the following:
apply plugin: 'devicefarm'
devicefarm {
// Required. The Project must already exist. You can create a project in the AWS console.
projectName "My Project"
// Required. You must specify either accessKey and secretKey OR roleArn. roleArn takes precedence.
authentication {
accessKey "aws-iam-user-accesskey"
secretKey "aws-iam-user-secretkey"
// OR
roleArn "My role arn"
}
} Advanced configurationapply plugin: 'devicefarm'
devicefarm {
// Required. The Project must already exist. You can create a project in the AWS 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 "aws-iam-user-accesskey"
secretKey "aws-iam-user-secretkey"
// OR
roleArn "My role arn"
}
// Optional block. Radios default to 'on' state, all parameters are optional
devicestate {
extraDataZipFile file("path/to/zip") // or ‘null’ if you have no extra data. Default is null.
auxiliaryApps files(file("path/to/app"), file("path/to/app2")) // or ‘files()’ if you have no auxiliary apps. Default is an empty list.
wifi "on"
bluetooth "off"
gps "off"
nfc "on"
latitude 47.6204 // default
longitude -122.3491 // default
}
// Optional. Set the test type. Default is instrumentation.
// You can only set one test type.
// See "Test Type configuration" below for configuration details
// Fuzz
fuzz {
}
// Instrumentation
instrumentation {
// Optional. See the AWS Developer docs for filter rules
filter "my-filter"
}
// Calabash
calabash {
tests file("path-to-features.zip")
}
}
Generating a proper IAM user:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DeviceFarmAll",
"Effect": "Allow",
"Action": [ "devicefarm:*" ],
"Resource": [ "*" ]
}
]
}
Test Type configurationAppiumDevice Farm provides support for Appium Java TestNG , Appium Java JUnit, Appium python, Appium Node.js and Appium Ruby for Android. You can choose to JUnit is the default and does not need to be explicitly specified. appium {
tests file("path to zip file") // Required
useTestNG() // or useJUnit() or usePython() or useNode() or useRuby()
testSpecName "My Test Spec Name" // if you want to use Custom Mode // Optional for TestNG, JUnit and Python
} Built-in: ExplorerUse 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"
} Built-in: FuzzDevice 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 is 50
eventCount 6000 // Optional. Default is 6000
randomizerSeed 1234 // Optional. Default is blank
} CalabashDevice 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
} InstrumentationDevice 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
testSpecName "My Test Spec Name" // if you want to use Custom Mode // Optional
} UI AutomatorUpload 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
} Building the pluginBuilding the plugin is optional. The plugin is published through Maven Central.
Adding New FrameworksAs 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
}
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论