Tests for Android with Gradle: Changing the JUnit Test Output File Name

When I run JUnit tests for my Android project using Gradle (via androidTest or connectedAndroidTest tasks), I get an automatically generated XML output file with the test results in the "build / output / androidTest-results / connected" section. This file is always called something like "TEST-NexusS_Android16 (AVD) - 4.1.2-app-.xml", depending on the device or emulator. I am running tests.

I would like to change the file name to something more general, for example, "junit-test-report.xml" (to be able to parse it using the Jenkins JUnit plugin without setting a specific file name for each device).

From http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Test-reports I know that I can set the output folder by setting

testOptions { reportDir = "$project.buildDir/foo/report" } 

in the Gradle build-file.

I think it should be possible to also change the file name? Could not find anything about this on the Internet.

Thanks for the help!

+6
source share

Source: https://habr.com/ru/post/982046/


All Articles