Gradle Unit tests: How to copy logs to artifacts on failure?

Hi, a new refugee from BuddyBuild here and I’m trying to get unit (and UI tests) running for Android.

I’ve added the Gradle Unit Test step, and confirmed that it runs the unit tests, and confirmed they stop the build as expected when they fail and report appropriately to GitHub.

However, how can I see what test failed? Do I need to have another step to copy the logs or ??

I get this in the log output, but I don’t know where to find the output file it references and/or how to copy it to the artifacts at the end.

Suggestions? Thanks in advance!

Execution failed for task ':core:testDebugUnitTest'.
> There were failing tests. 
> See the report at: file:///bitrise/src/core/build/reports/tests/testDebugUnitTest/index.html

Getting a bit further today with configuration and I see I have a similar problem if I add a lint check to the build. It fails the build ok, but I can’t see the lint logs to see why it failed or where it failed.

FWIW, my gradle unit test config now reads:

    - gradle-unit-test@1.0.5:
        - unit_test_task: ":core:ktlintCheck :app:ktlintCheck test"

You can use Deploy to step to achieve that. More info in devcenter:

Archive with test reports will be available for download on Apps & Artifacts tab.

Online preview (without downloading, for results other than single files) is not yet supported Out Of The Box however, there are some workarounds: Artifacts: Make it possible to view HTML files with relative links (CSS etc. refs)

1 Like

Note: we’re also working on step updates & new steps which will auto expose the results/reports of Android tests & lints, without additional configuration :wink:

1 Like