Pull allure results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//buildSrc | |
class PullResultsFromDevicesTask extends DefaultTask { | |
private Property<TestsRunConfig> config = project.objects.property(TestsRunConfig.class) | |
private DirectoryProperty testCasesDir = project.objects.directoryProperty() | |
@Input | |
Property<TestsRunConfig> getTestsRunConfig() { | |
return config | |
} | |
@InputDirectory | |
DirectoryProperty getTestCasesDirectory() { | |
return testCasesDir | |
} | |
@TaskAction | |
def execute() { | |
final String testCasesDirPath = testCasesDir.get().asFile.absolutePath | |
final File allureResultsDir = new File("${testCasesDirPath}/allure-results") | |
allureResultsDir.mkdir() | |
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") | |
} | |
} | |
//build.gradle | |
final File baseReportDir = project.file( | |
project.properties['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