Annotation Interface TestResourcesScope
Defines the test resources scope to use in a test
class. By default, all tests execute in the same
(root) scope, which means that they share the same
containers, for example.
In some cases, it may be needed to isolate a test
from others, by making sure it runs with its own
test resources (e.g containers).
When multiple tests are using the same scope, then
the resource will be shared between those tests,
and disposed whenever the last test which needed
that resource has finished.
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionClass<? extends ScopeNamingStrategy>
The name of the strategy to use, instead of an explicit name provided withvalue()
.The name of the test resources scope to use.
-
Element Details
-
value
String valueThe name of the test resources scope to use. A test can only use a single scope at once. Once the last test using this scope is executed, the scope will be automatically closed. If not set, you must provide anamingStrategy()
.- Returns:
- the name of the scope
- Default:
- ""
-
namingStrategy
Class<? extends ScopeNamingStrategy> namingStrategyThe name of the strategy to use, instead of an explicit name provided withvalue()
.- Returns:
- the naming strategy
- Default:
- io.micronaut.test.extensions.junit5.annotation.ScopeNamingStrategy.class
-