From 26126633501b0bc3f62436c891ce96a640a01b38 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 27 Nov 2024 11:59:57 +0200 Subject: [PATCH] Address leftovers in testing docs from #44685 (cherry picked from commit 107e4ea658ec01d911f63f73ddc5bc78e81872c7) --- .../asciidoc/getting-started-testing.adoc | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/docs/src/main/asciidoc/getting-started-testing.adoc b/docs/src/main/asciidoc/getting-started-testing.adoc index 6a13199331b05..916b16f57fd08 100644 --- a/docs/src/main/asciidoc/getting-started-testing.adoc +++ b/docs/src/main/asciidoc/getting-started-testing.adoc @@ -1241,25 +1241,15 @@ public @interface WithRepeatableTestResource { While test resources provided by `@QuarkusTestResource` are available either globally or restricted to the annotated test class (`restrictToAnnotatedClass`), the annotation `@WithTestResources` allows to additionally group tests by test resources for execution. `@WithTestResources` has a `scope` property that takes a `TestResourceScope` enum value: -- `TestResourceScope.MATCHING_RESOURCES` (default) + -Quarkus will group tests with the same test resources and run them together. After a group has been executed, all test resources will be stopped, and the next group will be executed. -- `TestResourceScope.RESTRICTED_TO_CLASS` + -The test resource is available only for the annotated test class and will be stopped after the test class has been executed. This is equivalent to using @QuarkusTestResource with restrictToAnnotatedClass = true. -- `TestResourceScope.GLOBAL` + -The test resource is available globally. -This is equivalent to using `@QuarkusTestResource` with `restrictToAnnotatedClass = false`. - -NOTE: `@QuarkusTestResource` is merely a convenient extension of `@WithTestResources` for the use of global test resources - -BELOW TO EDIT: + -I don't know the behaviour when different scopes are mixed 🤷‍♂️Example: -```java -@WithTestResources(value = TestResourceA.class, scope = TestResourceScope.MATCHING_RESOURCES) -@WithTestResources(value = TestResourceB.class, scope = TestResourceScope.RESTRICTED_TO_CLASS) -@WithTestResources(value = TestResourceC.class, scope = TestResourceScope.GLOBAL) -class TestClass(){} -``` -Also maybe add a use case example for why this annotation got introduced and what for the different scopes are useful, as we currently only use GLOBAL because of time reason. +- `TestResourceScope.MATCHING_RESOURCES` (default): Quarkus will group tests with the same test resources and run them together. After a group has been executed, all test resources will be stopped, and the next group will be executed. +- `TestResourceScope.RESTRICTED_TO_CLASS`: The test resource is available only for the annotated test class and will be stopped after the test class has been executed. +- `TestResourceScope.GLOBAL`: Test resources apply to all tests in the testsuite + +Quarkus needs to restart if one of the following is true: + +- At least one the existing test resources is restricted to the test class +- At least one the next test resources is restricted to the test class +- Different {@code MATCHING_RESOURCE} scoped test resources are being used == Hang Detection