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 a utility to log all differences when using XmlAssert in XMLUnit #442

Closed
sleberknight opened this issue Dec 10, 2023 · 0 comments · Fixed by #443
Closed

Add a utility to log all differences when using XmlAssert in XMLUnit #442

sleberknight opened this issue Dec 10, 2023 · 0 comments · Fixed by #443
Assignees
Labels
new feature A new feature such as a new class, method, package, group of classes, etc.
Milestone

Comments

@sleberknight
Copy link
Member

sleberknight commented Dec 10, 2023

This issue originates from the discussion Should we add a helper to log all differences when using XmlAssert in XmlUnit?. Also see the gist which contains sample code.

By default, XmlAssert stops comparing when it finds the first difference, and only reports that difference. So, if an XML comparison has multiple differences, you will only see the first one and won't know about any others until you've fixed the first one, then re-run the test, and then continue until all other comparison failures are fixed.

This issue aims to add a very simple utility that sits on top of XmlAssert to provide a simple way to compare all differences and log them as they occur. Initially, mark this utility as beta.

@sleberknight sleberknight added the new feature A new feature such as a new class, method, package, group of classes, etc. label Dec 10, 2023
@sleberknight sleberknight added this to the 3.1.0 milestone Dec 10, 2023
@sleberknight sleberknight self-assigned this Dec 10, 2023
sleberknight added a commit that referenced this issue Dec 10, 2023
* KiwiXmlAssert is a simple wrapper around XMLUnit's XmlAssert
  which logs all differences. It also provides some convenience
  methods to compare XML without any boilerplate code.
* LoggingComparisonListener is an XMLUnit ComparisonListener
  that logs differences found by XmlAssert.
* Both of these classes are marked Beta in this first iteration
* Additionally, added InMemoryAppender and InMemoryAppenderExtension,
  which provide test utilities for testing Logback messages.
  They are only in the test sources for now, but I documented
  them fully because I anticipate we might want to add them
  as full test utilities at some point. And if not, then at least
  they are documented for internal use within this library.

Closes #442
sleberknight added a commit that referenced this issue Dec 10, 2023
…443)

* KiwiXmlAssert is a simple wrapper around XMLUnit's XmlAssert
  which logs all differences. It also provides some convenience
  methods to compare XML without any boilerplate code.
* LoggingComparisonListener is an XMLUnit ComparisonListener
  that logs differences found by XmlAssert.
* Both of these classes are marked Beta in this first iteration
* Additionally, added InMemoryAppender and InMemoryAppenderExtension,
  which provide test utilities for testing Logback messages.
  They are only in the test sources for now, but I documented
  them fully because I anticipate we might want to add them
  as full test utilities at some point. And if not, then at least
  they are documented for internal use within this library.

Closes #442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature A new feature such as a new class, method, package, group of classes, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant