Skip to content

Add option to display only unexpected or missing elements in asserts on collections #292

@igorakkerman

Description

@igorakkerman

Hi, when an assert on elements of large collections fails, it would be very helpful to only see "bad" items, not those that were expected. Currently, all elements in the collection are shown.

For instance, with containsExactly / contains.inOrder.only.entries, a section is dedicated to every single element, the encountered element is equal to the expected one or not. A correct element is annotated using a ✔️. A wrong element at the index, it is marked with an ✘.

When dealing with a large number of elements, it can be tedious to find the bad elements. The test author should be able to indicate which elements should be displayed, all elements or only the differences between good and bad elements.

This could be achieved using an optional boolean flag showAll, defaulting to true, or an optional displayFlags object or enumeration, for example. The option could be selected individually for every assertion or through a global property.

See also this discussion on Slack:
https://kotlinlang.slack.com/archives/C887ZKGCQ/p1578313112006400

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions