-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Revisit extension registration model #112
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
Comments
- Revised visibility of methods in TestExtensionRegistry. - Renamed addExtension() to registerExtension() in TestExtensionRegistry. - Renamed LocalExtensionRegistry to DelegatingExtensionRegistry, documented its purpose, and avoided duplicate instantiation. - Removed superfluous use of generics in TestExtensionRegistry. - Overhauled documentation TestExtensionRegistry. - Removed extensionInstance in RegisteredExtensionPoint since it effectively duplicated extensionPoint. Issue: #112
- Revised visibility of methods in TestExtensionRegistry. - Renamed addExtension() to registerExtension() in TestExtensionRegistry. - Renamed LocalExtensionRegistry to DelegatingExtensionRegistry, documented its purpose, and avoided duplicate instantiation. - Removed superfluous use of generics in TestExtensionRegistry. - Overhauled documentation TestExtensionRegistry. - Removed extensionInstance in RegisteredExtensionPoint since it effectively duplicated extensionPoint. Issue: #112
Some team decisions:
|
A thing we talked about but did not decide on:
|
Do you mean a custom, user-provided name? Or do you mean a name that we infer from the source of the extension? (and by "source" I mean the class implementing |
Mostly the latter. But it should not work only for registrars but also for registering annotated methods (BeforeEach etc). See ClassTestDescriptor. Von meinem iPad gesendet
|
In order to improve error reporting and logging, a new 'source' property has been introduced in RegisteredExtensionPoint. If an extension point is registered declaratively via @ExtendWith, the 'extensionPoint' and 'source' properties will contain a reference to the same object; however, if an extension point is registered programmatically -- for example, by an ExtensionRegistrar as a lambda expression or by the framework via the TestExtensionRegistry -- the 'source' may be the ExtensionRegistrar that registered the extension point, the underlying method that implements the extension point API, or similar. The source is currently used for error reporting in ExtensionPointSorter when conflicting extensions are encountered. In addition, the source is logged under the 'org.junit.gen5.engine.junit5.execution' category at the TRACE log level whenever an extension is registered. Issue: #112
FYI: (from commit 8a11695) In order to improve error reporting and logging, a new If an extension point is registered declaratively via The source is currently used for error reporting in |
I did not reintroduce the extension name, since it is not always clear what the name should be. I instead opted to track the source as described above. If you execute Here's some sample output:
|
"Source" sounds more intention revealing to me. Thanks.
|
We forgot one:
|
Here's my take on the current s tate of extension registration. I also think it needs some overhaul.
|
Closing this issue since many of the issues have already been addressed or will be addressed in #506. |
Status Quo
The extension registration model is currently a work in progress and needs to be revisited to make sure it aligns with the needs of the extension authors and the community at large.
Topics to Review and Revisit
TestExtension
vs.ExtensionPoint
TestExtension
serve since the introduction ofExtensionPoint
? Do we need two maker interfaces for extensions?ExtensionPoint
vsRegisteredExtensionPoint
ExtensionPointSorter
ExtensionPoint
? Why not allow any type ofTestExtension
to be sorted?ExtensionRegistry
vs.TestExtensionRegistry
ExtensionRegistry
currently allows one to register only instances ofExtensionPoint
. So why isn't it called anExtensionPointRegistry
?ExtensionPoint.Position
Position
specific toExtensionPoint
?DEFAULT
position) alongside user code. So what purpose doesDEFAULT
serve?Position
defines only 5 options for extension authors. Why should JUnit be so restrictive? Why not allow any numerical ordering (e.g., the entire range of integers, perhaps other than0
) beyond the hard coded 5 current values?@Order
that can be reused across multiple use cases within the framework.ExtensionRegistry
; however, there is no mechanism for overriding extensions that have already been registered (e.g., in superclasses).The text was updated successfully, but these errors were encountered: