Package io.quarkus.test.junit.util
Class QuarkusTestProfileAwareClassOrderer
- java.lang.Object
-
- io.quarkus.test.junit.util.QuarkusTestProfileAwareClassOrderer
-
- All Implemented Interfaces:
org.junit.jupiter.api.ClassOrderer
public class QuarkusTestProfileAwareClassOrderer extends Object implements org.junit.jupiter.api.ClassOrderer
AClassOrdererthat ordersQuarkusTestandQuarkusIntegrationTestclasses for minimum Quarkus restarts by grouping them by theirTestProfile. By default, Quarkus*Tests not using any profile come first, then classes using a profile (in groups) and then all other non-Quarkus tests (e.g. plain unit tests). Internally, ordering is based on three prefixes that are prepended to the fully qualified name of the respective class, with the fully qualified class name of theQuarkusTestProfileas an infix (if present). The default prefixes are defined byDEFAULT_ORDER_PREFIX_*and can be overridden injunit-platform.propertiesviaCFGKEY_ORDER_PREFIX_*, e.g. non-Quarkus tests can be run first (not last) by settingCFGKEY_ORDER_PREFIX_NON_QUARKUS_TESTto10_.getCustomOrderKey(ClassDescriptor, ClassOrdererContext)can be overridden to provide a custom order number for a given test class, e.g. based onTag, class name or something else. Limitations:- This orderer does not (yet) consider test resources that are restricted to the annotated class.
- Only JUnit5 test classes are subject to ordering, e.g. ArchUnit test classes are not passed to this orderer.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static StringCFGKEY_ORDER_PREFIX_NON_QUARKUS_TEST(package private) static StringCFGKEY_ORDER_PREFIX_QUARKUS_TEST(package private) static StringCFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILEprotected static StringDEFAULT_ORDER_PREFIX_NON_QUARKUS_TESTprotected static StringDEFAULT_ORDER_PREFIX_QUARKUS_TESTprotected static StringDEFAULT_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILE
-
Constructor Summary
Constructors Constructor Description QuarkusTestProfileAwareClassOrderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Optional<String>getCustomOrderKey(org.junit.jupiter.api.ClassDescriptor classDescriptor, org.junit.jupiter.api.ClassOrdererContext context)Template method that provides an optional custom order key for the givenclassDescriptor.voidorderClasses(org.junit.jupiter.api.ClassOrdererContext context)
-
-
-
Field Detail
-
DEFAULT_ORDER_PREFIX_QUARKUS_TEST
protected static final String DEFAULT_ORDER_PREFIX_QUARKUS_TEST
- See Also:
- Constant Field Values
-
DEFAULT_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILE
protected static final String DEFAULT_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILE
- See Also:
- Constant Field Values
-
DEFAULT_ORDER_PREFIX_NON_QUARKUS_TEST
protected static final String DEFAULT_ORDER_PREFIX_NON_QUARKUS_TEST
- See Also:
- Constant Field Values
-
CFGKEY_ORDER_PREFIX_QUARKUS_TEST
static final String CFGKEY_ORDER_PREFIX_QUARKUS_TEST
- See Also:
- Constant Field Values
-
CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILE
static final String CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILE
- See Also:
- Constant Field Values
-
CFGKEY_ORDER_PREFIX_NON_QUARKUS_TEST
static final String CFGKEY_ORDER_PREFIX_NON_QUARKUS_TEST
- See Also:
- Constant Field Values
-
-
Method Detail
-
orderClasses
public void orderClasses(org.junit.jupiter.api.ClassOrdererContext context)
- Specified by:
orderClassesin interfaceorg.junit.jupiter.api.ClassOrderer
-
getCustomOrderKey
protected Optional<String> getCustomOrderKey(org.junit.jupiter.api.ClassDescriptor classDescriptor, org.junit.jupiter.api.ClassOrdererContext context)
Template method that provides an optional custom order key for the givenclassDescriptor.- Parameters:
classDescriptor- the respective test classcontext- for config lookup- Returns:
- optional custom order key for the given test class
-
-