-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Apply suite configuration to tests selected by unique ID #3694
Apply suite configuration to tests selected by unique ID #3694
Conversation
...platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the super fast PR! 👍
I think it looks pretty solid, but I've requested a few minor enhancements.
documentation/src/docs/asciidoc/release-notes/release-notes-5.11.0-M1.adoc
Outdated
Show resolved
Hide resolved
@@ -198,6 +196,16 @@ public SuiteLauncherDiscoveryRequestBuilder suite(Class<?> suiteClass) { | |||
return this; | |||
} | |||
|
|||
public SuiteLauncherDiscoveryRequestBuilder suiteConfigurationParameters(Class<?> suiteClass) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized we don't have any Javadoc for SuiteLauncherDiscoveryRequestBuilder
. 😱
So we should definitely address that, but rather in a different issue.
In any case, I'd like to see some Javadoc on this new method.
In addition, let's come up with a more descriptive name, perhaps something like one of the following.
configurationParametersForSuite(Class<?>)
configurationParametersForSuiteClass(Class<?>)
configurationParametersFromSuite(Class<?>)
applyConfigurationParametersFromSuite(Class<?>)
I know the last one is a bit long and doesn't start with configurationParameter
like the existing methods; however, I do think it aptly describes what it does (which is a bit special compared to the existing configurationParameter()
and configurationParameters()
methods).
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skipped the Javadoc because most classes marked as internal were lacking it. I'll add some for new methods.
Namingwise, I am considering deprecating the existing suite(Class<?>)
method and replacing it with two methods:
applyConfigurationParametersFromSuite(Class<?>)
applySelectorsAndFiltersFromSuite(Class<?>)
And then also look at a way to avoid invoking applyConfigurationParametersFromSuite()
over and over again for every unique ID.
In hindsight these are two rather distinct operations. It just didn't occur to me when I wrote the suite engine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skipped the Javadoc because most classes marked as internal were lacking it. I'll add some for new methods.
Indeed, it is marked as internal even though it's public
. I had overlooked that.
In any case, I think it's still worth documenting (even if it's "just for us").
I raised #3695 to address that.
Speaking of which, would you like to address #3695?
I'm asking because someone else has already volunteered to do that, and I want to avoid duplicate work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namingwise, I am considering deprecating the existing
suite(Class<?>)
method and replacing it with two methods:* `applyConfigurationParametersFromSuite(Class<?>)` * `applySelectorsAndFiltersFromSuite(Class<?>)`
I like that. 👍
I'm also wondering if we should add a precondition check which requires that the supplied Class
is annotated with @Suite
.
Or... perhaps that's over-engineering. 🤷
And then also look at a way to avoid invoking
applyConfigurationParametersFromSuite()
over and over again for every unique ID.
Yes, please do that.
In hindsight these are two rather distinct operations. It just didn't occur to me when I wrote the suite engine.
No worries. It's a learning process, and APIs are meant to evolve (in a non-breaking manner). 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking because someone else has already volunteered to do that, and I want to avoid duplicate work.
That's quick! This looks like a good issue for a first time contributor, so I'm happy to see someone else try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also wondering if we should add a precondition check which requires that the supplied Class is annotated with @suite.
Or... perhaps that's over-engineering. 🤷
That would be a breaking change. The @Suite
annotation is optional for the JUnitPlatform
runner.
…11.0-M1.adoc Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 👍
I second that. Thanks again for raising the issue and for the well-executed PR. 👍 p.s. I polished a bit in 2a5c6b2. |
Cheers! You're welcome. I think I've said before, it's nice to work on a codebase where everything is clear and well organized. |
Tests in a suite selected by unique id did not receive their configuration because this was only applied to the discovery request builder when a suite class was selected. By splitting the processing of configuration annotations and select and filter annotations, the configuration can now always be applied prior to discovery. Fixes #3693. (cherry picked from commit 74bd85c)
Overview
Applies suite configuration to tests selected by unique ID.
Tests in a suite selected by id did not receive their configuration because this was only applied to the discovery request builder when a suite class was selected. By splitting the processing of configuration annotations and select and filter annotations, the configuration can now always be applied prior to discovery.
Fixes: #3693
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations