Search code examples
androidtestingoutput

Android - Connected Tests Results Directory


I have an android project where I run normal unit tests as well as instrumented tests.


Now the thing is that the results of the

  • unit tests are stored in build/reports/tests (./debug or ./release)
  • instrumented tests are stored in build/outputs/connected

Is it somehow possible to change the result directory of the instrumented tests to build/reports/tests/connected?

Thank you already!


Solution

  • Found the answer myself, To change the directory for instrumented tests use:

    android {
        testOptions {
            reportDir = "$project.buildDir/reports"
            resultsDir = "$project.buildDir/test-results"
        }
    
        # Or for lint if needed
        lintOptions {
            htmlOutput = file("$project.buildDir/reports/lint/LINT-results.html")
            xmlOutput = file("$project.buildDir/test-results/lint/LINT-results.xml")
        }
    }