From 355e4896a4a715e4259b8a664d4fd83acb163838 Mon Sep 17 00:00:00 2001 From: Stefan Spieker Date: Mon, 16 Dec 2024 01:00:31 +0100 Subject: [PATCH] Added short section about ClassRule for JenkinsRule (#7756) added short section about ClassRule for JenkinsRule --- content/doc/developer/testing/index.adoc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/content/doc/developer/testing/index.adoc b/content/doc/developer/testing/index.adoc index d43d993950fb..0c0cd0abc20c 100644 --- a/content/doc/developer/testing/index.adoc +++ b/content/doc/developer/testing/index.adoc @@ -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.