Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diff section to report of AssertionFailedError failures #3397

Conversation

bechte
Copy link
Contributor

@bechte bechte commented Jul 18, 2023

Overview

With this commit, a dependency to https://github.com/java-diff-utils/java-diff-utils is introduced. java-diff-utils is used to create a diff from the expected and the actual result and report it.

See #3139

Open questions:

  • Shall we shadow the external library?
  • Shall we provide configuration parameters for the console launcher to adjust the markers for "old" (currently: ~) and "new" (currently: **) text.
  • Shall we include these changes also into other DetailsPrintingListeners or is it already sufficient for the FlatPrintingListener (I started with this in the sense of a small PoC)?

I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@bechte bechte added component: Platform dependencies Pull requests that update a dependency file labels Jul 18, 2023
@bechte bechte force-pushed the feature/consolelauncher-to-output-diff-of-expected-and-actual-string-values branch from c75bb85 to 4560a27 Compare July 18, 2023 21:01
With this commit, a dependency to https://github.com/java-diff-utils/java-diff-utils is introduced.
java-diff-utils is used to create a diff from the expected and the actual result and report it.

See #3139
@bechte bechte force-pushed the feature/consolelauncher-to-output-diff-of-expected-and-actual-string-values branch from 4560a27 to 6daf44e Compare July 19, 2023 21:46
@sormuras
Copy link
Member

Hi Stefan, thanks for the PR.

Shall we shadow the external library?

Yes, please.

Shall we provide configuration parameters for the console launcher to adjust the markers for "old" (currently: ~) and "new" (currently: **) text.

Let's go with same length for the tags (fixed for the time being): ~ and *

It would be also cool, if the theme of the console launcher could be supported:

  • ASCII (~ and *) vs Unicode (for example: and or )
  • with ANSI colors (and strike-through for "old"?) vs. without colors. See Theme and Palette classes for details.

Shall we include these changes also into other DetailsPrintingListeners or is it already sufficient for the FlatPrintingListener (I started with this in the sense of a small PoC)?

Once the layout is settled, all printing listeners should support this new diff feature. Or do you see problems with rendering the diff in other printers than the FlatPrintingListener?

@marcphilipp
Copy link
Member

@bechte Do you have time to continue on this?

@marcphilipp
Copy link
Member

Superseded by #4017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConsoleLauncher should output diff of expected and actual String values
3 participants