Skip to content
kb0 edited this page Apr 23, 2014 · 2 revisions

pull screenshots from device using adb, to project directory

@TODO implement loop for all connected devices

task connectedAndroidTestResults(type: Exec, dependsOn: 'connectedAndroidTest') {
    def rootDir = project.rootDir
    def buildDir = project.buildDir

    def localProperties = new File(rootDir, "local.properties")
    if (localProperties.exists()) {
        Properties properties = new Properties()
        localProperties.withInputStream {
            instr -> properties.load(instr)
        }
        def sdkDir = properties.getProperty('sdk.dir')

        commandLine "$sdkDir/platform-tools/adb", 'pull', '/sdcard/Robotium-Screenshots', "$buildDir/androidTest-results/"
    } else {
        throw new StopExecutionException()
    }
}
Clone this wiki locally