Skip to content

Context of the Test is passed to the constructor when test instance is created #2961

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

Conversation

svenkost
Copy link

@svenkost svenkost commented Jul 4, 2022

Overview

This change will give a MethodExtensionContext instead of a ClassExtensionContext to the construction of a constructor for a Test(Template). Before this change, if a test was created, there was no context for what the test was run, now there is context and also the display-name can be taken from the context.


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


Definition of Done

@svenkost svenkost changed the title Now the context of the TestTemplate is passed to the constructor when… Context of the Test is passed to the constructor when test instance is created Jul 7, 2022
@svenkost svenkost mentioned this pull request Jul 7, 2022
1 task
throwableCollector.execute(() -> {
invokeTestInstancePostProcessors(instances.getInnermostInstance(), registry, extensionContext);
invokeTestInstancePostProcessors(instances.getInnermostInstance(), registry,
Objects.isNull(clientContext) ? extensionContext : clientContext);
Copy link
Member

Choose a reason for hiding this comment

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

❌ I think we cannot simply change with which context we invoke these extension points. It's currently the container extension context for consistency with different test instance lifecycles. We could add an additional, optional context, though. 🤔

Copy link
Author

Choose a reason for hiding this comment

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

That is also an idea, but it means that one method override gets multiple contexts instead of only one.

@stale
Copy link

stale bot commented Sep 8, 2022

This pull request has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be closed if no further activity occurs. If you intend to work on this pull request, please reopen the PR. Thank you for your contributions.

@stale stale bot added the status: stale label Sep 8, 2022
@stale
Copy link

stale bot commented Sep 29, 2022

This pull request has been automatically closed due to inactivity. If you are still interested in contributing this, please ensure that it is rebased against the latest branch (usually main), all review comments have been addressed and the build is passing.

@stale stale bot closed this Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants