Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pull allure results
class PullResultsFromDevicesTask extends DefaultTask {
private Property<TestsRunConfig> config =
private DirectoryProperty testCasesDir = project.objects.directoryProperty()
Property<TestsRunConfig> getTestsRunConfig() {
return config
DirectoryProperty getTestCasesDirectory() {
return testCasesDir
def execute() {
final String testCasesDirPath = testCasesDir.get().asFile.absolutePath
final File allureResultsDir = new File("${testCasesDirPath}/allure-results")
config.get().devices.each { String device ->
project.exec {
commandLine('adb', '-s', device, 'pull', '/sdcard/allure-results', testCasesDirPath)
allureResultsDir.renameTo(new File("${testCasesDirPath}/results"))
println("Allure results pulled from ${config.get().devices} devices successfully")
final File baseReportDir = project.file(['reportsOutputDir'] ?: new File(rootProject.buildDir, 'reports')
final File testCasesDir = new File(baseReportDir, 'json')
final TaskProvider pullResultsFromDevices = tasks.register('pullResultsFromDevices', PullResultsFromDevicesTask) {
description = 'Pulls allure results from all devices and puts them together in results file'
group = 'TestsRun'
testsRunConfig = config
testCasesDirectory = testCasesDir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment