Skip to content

Allows developers to easily use JSON files as sources for their parameterized tests #22

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

istarwyh
Copy link

Proposed Change

Provides a way to supply arguments to parameterized tests in JUnit 5 by reading JSON files specified by the {@link JsonFileSource} annotation.
The {@code JsonFileArgumentsProvider} is responsible for locating the JSON files specified in the annotation, reading their contents, and converting them into objects of the type expected by the test method parameters. It supports both simple and generic types, including handling of recursive type references by setting them to {@code null} to prevent infinite loops during JSON parsing.

Type Of Change

What type of change does this PR introduce?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • All unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further Comments

As a backend engineer at Alibaba Group, I've found JUnit 5 to be an excellent testing framework that provides a lot of flexibility and power. However, I noticed that it lacks built-in support for JSON sources in parameterized tests, which is a feature that could significantly enhance the testing of JSON-dependent applications.

To address this, I propose the addition of the JsonFileSource annotation, accompanied by the JsonFileArgumentsProvider class. This feature allows developers to easily use JSON files as sources for their parameterized tests, enabling more comprehensive and data-driven testing scenarios.

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.

1 participant