android / android/android-test

Feature request: improve error message when Espresso `Intent` matching fails due to mismatched `Intent` `data`

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

Description

When Espresso `Intent`-matching fails to find a matching intent, it prints an error message:

https://github.com/android/android-test/blob/f7d881ad2f36cb045cb2ec6da13cf0ec198c606f/espresso/intents/java/androidx/test/espresso/intent/VerificationModes.java#L56-L57

that includes string representations of all expected `Intent`s and all recorded `Intent`s.

Currently, this error message obfuscates the `data` associated with each `Intent`, because `ResolvedIntentImpl::toString`:

https://github.com/android/android-test/blob/f7d881ad2f36cb045cb2ec6da13cf0ec198c606f/espresso/intents/java/androidx/test/espresso/intent/ResolvedIntentImpl.java#L57

relies on `Intent::toString` rather than `Intent::toInsecureString`.

This makes debugging difficult if the reason for the `Intent` matching failure is a discrepancy in `Intent` `data`. Ideally, `ResolvedIntentImpl::toString` would use `Intent::toInsecureString` rather than `Intent::toString`, but I don't know how feasible that is.

Contributor guide

Open the contributing guide

Research direction

Start with the referenced failure reporting in espresso/intents/java/androidx/test/espresso/intent/VerificationModes.java and the toString implementation in ResolvedIntentImpl.java. Check how expected and recorded Intents are rendered, then verify that a mismatched Intent data value is visible in the resulting error message.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile, testing
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.