Skip to content

Commit

Permalink
Added short section about ClassRule for JenkinsRule (#7756)
Browse files Browse the repository at this point in the history
added short section about ClassRule for JenkinsRule
  • Loading branch information
StefanSpieker authored Dec 16, 2024
1 parent c9bb3d5 commit 355e489
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion content/doc/developer/testing/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -649,4 +649,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.

0 comments on commit 355e489

Please sign in to comment.