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

Added short section about ClassRule for JenkinsRule #7756

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion content/doc/developer/testing/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -604,4 +604,11 @@ TODO: RestartableJenkinsRule.
=== Custom builder

== Advanced and Tips etc.
//Tip: Use @ClassRule for JenkinsRule, if you're 900% sure that everything is ok

This section covers advanced topics and tips to improve testing.

=== `ClassRule` for `JenkinsRule`

Use `@ClassRule` with `JenkinsRule` when you want to share a single Jenkins instance across all tests in the class, especially when you need to avoid repeated setup and teardown of the Jenkins environment.
It’s a great way to optimize your tests when you don’t need a fresh Jenkins instance for every single test method, but instead want to run tests that all rely on the same shared Jenkins setup.
The field annotated with `@ClassRule` must be static because it is shared across all instances of the test class.
Loading