Annotation Interface WithTestResource
WARNING: this annotation, introduced in 3.13, caused some issues so it was decided to undeprecate
QuarkusTestResource and rework the behavior of this annotation. For now, we recommend not using it
until we improve its behavior.
Note: When using the restrictToAnnotatedClass=true (which is the default), each test that is annotated
with @WithTestResource will result in the application being re-augmented and restarted (in a similar fashion
as happens in dev-mode when a change is detected) in order to incorporate the settings configured by the annotation.
If there are many instances of the annotation used throughout the testsuite, this could result in slow test execution.
All WithTestResource annotations in the test module
are discovered (regardless of the test which contains the annotation)
and their corresponding QuarkusTestResourceLifecycleManager
started before any test is run.
Note that test resources are never restarted when running @Nested test classes.
The only difference with QuarkusTestResource is that the default value for
restrictToAnnotatedClass() == true.
This means that any resources managed by value() apply to an individual test class or test profile, unlike with
QuarkusTestResource where a resource applies to all test classes.
-
Nested Class Summary
Nested Classes -
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether this test resource is to be started in parallel (concurrently) along with others also marked as parallelbooleanWhether this annotation should only be enabled if it is placed on the currently running test class or test profile.
-
Element Details
-
value
Class<? extends QuarkusTestResourceLifecycleManager> value- Returns:
- The class managing the lifecycle of the test resource.
-
-
-
initArgs
ResourceArg[] initArgs- Returns:
- The arguments to be passed to the
QuarkusTestResourceLifecycleManager - See Also:
- Default:
- {}
-
parallel
boolean parallelWhether this test resource is to be started in parallel (concurrently) along with others also marked as parallel- Default:
- false
-
restrictToAnnotatedClass
boolean restrictToAnnotatedClassWhether this annotation should only be enabled if it is placed on the currently running test class or test profile. Note that this defaults to true for meta-annotations since meta-annotations are only considered for the current test class or test profile.Note: When this is set to
true(which is the default), the annotation@WithTestResourcewill result in the application being re-augmented and restarted (in a similar fashion as happens in dev-mode when a change is detected) in order to incorporate the settings configured by the annotation.- Default:
- true
-