android / android/android-test

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

Open
#2,329 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

### 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

Contributor guide

Open the contributing guide

Research direction

Start by locating the DefaultFailureHandler and tracing how it names and saves screenshots when a test fails. Reproduce the issue with a suite containing multiple failures, then verify that each saved screenshot has a distinct test name and that screenshots from all failures remain available.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.