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

QuarkusComponentTest: support parameterized test methods #38929

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

mkouba
Copy link
Contributor

@mkouba mkouba commented Feb 21, 2024

  • arguments of a parameterized test method that are provided by an ArgumentsProvider must be annotated with SkipInject

- arguments of a parameterized test method that are provided by an
ArgumentsProvider must be annotated with SkipInject
@mkouba mkouba force-pushed the component-test-parameterized-methods branch from adf1e91 to 54a9ea3 Compare February 21, 2024 15:29
Copy link
Contributor

@Ladicek Ladicek left a comment

Choose a reason for hiding this comment

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

Looks good, but it makes me think about:

Out of these, at least @RepeatedTest should work out of the box if we added the annotation to isTestMethod(). The other two are likely more complex.

@mkouba
Copy link
Contributor Author

mkouba commented Feb 21, 2024

Looks good, but it makes me think about:

* `@RepeatedTest` (https://junit.org/junit5/docs/current/user-guide/#writing-tests-repeated-tests)

* `@TestTemplate` (https://junit.org/junit5/docs/current/user-guide/#writing-tests-test-templates)

* `@TestFactory` (https://junit.org/junit5/docs/current/user-guide/#writing-tests-dynamic-tests)

Out of these, at least @RepeatedTest should work out of the box if we added the annotation to isTestMethod(). The other two are likely more complex.

That's a good point. It's not a goal to support all features provied by JUnit though.

@Ladicek would you care to add the @RepeatedTest support (and test) in this PR?

@manovotn
Copy link
Contributor

@Ladicek would you care to add the @RepeatedTest support (and test) in this PR?

Is there a reason why we keep the injection just to test methods? The ParameterResolver allows to do the same for before each callbacks etc., we might be able to do that just as well, right?
Perhaps the only one that doesn't make sense would then be test instance c-tor injection.

@Ladicek
Copy link
Contributor

Ladicek commented Feb 21, 2024

I can tackle @RepeatedTest, sure. That seems fairly easy and a good thing to have.

This comment has been minimized.

Copy link

github-actions bot commented Feb 21, 2024

🙈 The PR is closed and the preview is expired.

@Ladicek
Copy link
Contributor

Ladicek commented Feb 21, 2024

Added a commit for repeated tests support. Turns out we already ignored a parameter of type RepetitionInfo, so I just had to modify isTestMethod to recognize the @RepeatedTest annotation.

@mkouba
Copy link
Contributor Author

mkouba commented Feb 21, 2024

@Ladicek would you care to add the @RepeatedTest support (and test) in this PR?

Is there a reason why we keep the injection just to test methods? The ParameterResolver allows to do the same for before each callbacks etc., we might be able to do that just as well, right? Perhaps the only one that doesn't make sense would then be test instance c-tor injection.

This could cause some lifecycle issues. For example, if Lifecycle.PER_METHOD is used then you wouldn't be able to inject params of an @BeforeAll method because the container is not started yet...

@mkouba mkouba added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Feb 21, 2024
@manovotn
Copy link
Contributor

@Ladicek would you care to add the @RepeatedTest support (and test) in this PR?

Is there a reason why we keep the injection just to test methods? The ParameterResolver allows to do the same for before each callbacks etc., we might be able to do that just as well, right? Perhaps the only one that doesn't make sense would then be test instance c-tor injection.

This could cause some lifecycle issues. For example, if Lifecycle.PER_METHOD is used then you wouldn't be able to inject params of an @BeforeAll method because the container is not started yet...

Oh right, I didn't realize it's done differently from what we had on Weld 👍

Copy link

quarkus-bot bot commented Feb 21, 2024

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit b7a6b48.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

⚠️ There are other workflow runs running, you probably need to wait for their status before merging.

Copy link

quarkus-bot bot commented Feb 21, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit b7a6b48.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

@mkouba mkouba merged commit e01528c into quarkusio:main Feb 21, 2024
25 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.9 - main milestone Feb 21, 2024
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants