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

Nobody has claimed this yet.

Assessment

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

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.

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 Intents and all recorded Intents.

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.

Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
1d 14h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/android-test

All issues in android/android-test

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.