Skip to content

Include the test name in the screenshot file name generated by the DefaultFailureHandler #2329

@Futsch1

Description

@Futsch1

Description

It would be great to extend the DefaultFailureHandler so that the name of the test becomes part of the file name of the screenshot that is saved on failure.

I have worked around that issue by implementing a custom FailureHandler (https://github.com/Futsch1/medTimer/blob/main/app/src/androidTest/java/com/futsch1/medtimer/MyFailureHandler.java), but I suppose this change could be of general interest.

Steps to Reproduce

Run a test suite with several tests, where more than one failure occurs.

Expected Results

Screenshots are present for each occurred failure

Actual Results

Only the screenshot(s) of the last failed run will be present.

AndroidX Test and Android OS Versions

Android Test version 3.6.1
Android OS version not relevant

Link to a public git repo demonstrating the problem:

https://github.com/Futsch1/medTimer/actions/runs/12536536718/job/34960077359 respectively corresponding reports here: https://github.com/Futsch1/medTimer/actions/runs/12536536718/artifacts/2369493552

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions