-
Notifications
You must be signed in to change notification settings - Fork 125
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
[JENKINS-72387] Provide JUnit5 Class (static) context for JenkinsRule #689
Conversation
@WithJenkins | ||
class JenkinsRuleClassResolverTest { | ||
|
||
static JenkinsRule rule; |
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.
Rather than reflection would it be cleaner to explicitly register it do you think?
https://junit.org/junit5/docs/current/user-guide/#extensions-registration-programmatic
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 was trying to avoid having different solutions for the different contexts.
@WithJenkins
on the class or method gets you test-method parameter injection. Having a different approach for the class test context creates additional complexity for the consuming devs.
with similar failures in |
See JENKINS-72387.
I'd like to add support for creating one running Jenkins instance per Test Class, when using the JUnit5 extension points.
Due to how the JenkinsRule and underlying contexts expect population of the Jenkins
testDescription
, some refactoring of was required. This was necessary to find all annotations that may exist in all contexts - which would define the pre-test state of the Jenkins instance.Testing done
All previous tests pass, including the original which tested code this PR has refactored/modified (
JenkinsRuleResolverTest
).Added an additional test (
JenkinsRuleClassResolverTest
) to ensure the explicit feature was validated.Submitter checklist