Reputation: 125
I want to use AWS Device Farm for mobile app testing but I cannot see any support for Appium with Serenity BDD & Gradle
as per their documentation.
I have seen AWS device farm is supporting the below
Test Type Configuration
Appium JUnit
Appium TestNG
Built-in: Explorer
Built-in: Fuzz
Calabash
Can anyone confirm if the device farm supports Appium with Serenity BDD & Gradle
? I couldn't find this answer in their forum.
If it supports, could also share some examples please?
Thanks
Vamc
Upvotes: 2
Views: 1452
Reputation: 125
From the above answer, I was able to build zip file without dependencies folder so I struggled to find out how to build zip file with dependencies as device farm expected. Here is the way to add dependencies in build.gradle file and with above tasks(Copied from above), we can see dependencies folder added up in the zip file.
dependencies {
runtime group: 'net.serenity-bdd', name: 'serenity-junit', version: '2.0.18'
runtime group: 'net.serenity-bdd', name: 'serenity-cucumber', version: '1.9.20'
runtime group: 'net.serenity-bdd', name: 'serenity-reports-configuration', version: '1.9.43'
runtime group: 'org.assertj', name: 'assertj-core', version: '3.11.1'
runtime group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
runtime group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '3.0.0'
}
dependencies {
testCompile(
'net.serenity-bdd:serenity-junit:2.0.18',
'net.serenity-bdd:serenity-cucumber:1.9.20',
'org.assertj:assertj-core:3.11.1',
'ch.qos.logback:logback-classic:1.2.3',
'io.github.bonigarcia:webdrivermanager:3.0.0'
)
}
task getDeps(type: Copy) {
from sourceSets.main.runtimeClasspath
into 'build/libs/dependency-jars'
}
//packaging tests task which is generated from sample using gradle init
task packageTests(type: Jar) {
dependsOn getDeps
from sourceSets.test.output
classifier = 'tests'
}
//create zip archive
task zip(type: Zip) {
dependsOn packageTests
from 'build/libs/'
include '*'
include '*/*' //to include contents of a folder present inside dependency-jars directory
archiveName 'zip-with-dependencies.zip'
destinationDir(file('build/libs/'))
}
Upvotes: 0
Reputation: 2385
I believe that this should be possible using the custom environments option when scheduling a run in Device Farm. Admittedly, I don't have experience with serenity but here is blog which uses cucumber tests.
It looks like serenity is similar or extended from cucumber so in theory this might work.
[Edit]
Here are a few short gradle build tasks which should help to create a test package for Device Farm.
Note: this assumes that the dependencies are structured in the build.gradle file like this:
dependencies {
testCompile(
'net.serenity-bdd:serenity-junit:2.0.18',
'net.serenity-bdd:serenity-cucumber:1.9.20',
'org.assertj:assertj-core:3.11.1',
'ch.qos.logback:logback-classic:1.2.3',
'io.github.bonigarcia:webdrivermanager:3.0.0'
)
}
sample build.gradle code
//source: https://stackoverflow.com/a/27455099/8016330
task getDeps(type: Copy) {
from sourceSets.test.runtimeClasspath
// if you need this from the dependencies in the build.gradle then it should be :
// from sourceSets.main.runtimeClasspath
into 'build/libs/dependency-jars'
}
//packaging tests task which is generated from sample using gradle init
task packageTests(type: Jar) {
dependsOn getDeps
from sourceSets.test.output
classifier = 'tests'
}
//create zip archive
//source: https://stackoverflow.com/a/36883221/8016330
task zip(type: Zip) {
dependsOn packageTests
from 'build/libs/'
include '*'
include '*/*' //to include contents of a folder present inside dependency-jars directory
archiveName 'zip-with-dependencies.zip'
destinationDir(file('build/libs/'))
}
Then you should be able to create the zip file using this command:
./gradlew clean zip
Note: You'll need the clean command otherwise it will package the previous zip archive in the new zip archive.
Hth
-James
Upvotes: 2