Was debugging some test failures today, and was finding it hard to debug because upon failure only a couple lines of stdout and stderr were included in the test report.
Instead wanted to trace through the full log, however, when running the tests via command line with gradle (as our CI does), it was not outputting anything to command line.
Found this approach: [https://itecnote.com/tecnote/gradle-how-to-get-output-from-test-stderr-stdout-into-console/](https://itecnote.com/tecnote/gradle-how-to-get-output-from-test-stderr-stdout-into-console/) - however its more oriented towards a jvm build, not an android build. After some further digging found a couple other docs:
[https://developer.android.com/studio/test/advanced-test-setup](https://developer.android.com/studio/test/advanced-test-setup)
[https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html)
And put it together to find that this setup works:
```
android {
testOptions {
unitTests {
all {
testLogging {
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}
}
```
Hope this helps someone!