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

feat: Refactor JSON report comparison for better diffing in unit-tests. #1352

Merged
merged 2 commits into from
Mar 13, 2023

Conversation

bdferris-v2
Copy link
Collaborator

Refactor JSON test artifact checks in the acceptance test output-comparison tool to make it easier to understand diffs when tests fail or or a test is updated. Currently, the JSON output report is tested in the unit-test as a single-line, non-pretty-printed string, which makes it really hard to tell what changed when the test fails or is updated. This PR refactors the test to check a pretty-printed version of the JSON output for better diffing. The expected content of the report is stored as a resource in the test/resources directory, since inlining a multi-line string is still pretty ugly in Java.

This refactor is in support of issue #1349 where some changes to the output comparator are coming in a follow-up PR.

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues

@bdferris-v2 bdferris-v2 marked this pull request as ready for review March 13, 2023 15:30
@github-actions
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1420 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1420 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1420 sources (~0 %) are corrupted.
Commit: ddec36f
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM

@bdferris-v2 bdferris-v2 merged commit 4cda198 into master Mar 13, 2023
@bdferris-v2 bdferris-v2 deleted the issue/1349/test_refactor branch March 13, 2023 20:43
ryon pushed a commit to JarvusInnovations/gtfs-validator that referenced this pull request Apr 1, 2023
…s. (MobilityData#1352)

* Refactor JSON report comparison for better diffing in unit-tests.
* Rename test resources for clarity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants