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 ordersQuarkusTest,QuarkusIntegrationTestandQuarkusMainTestclasses for minimum Quarkus restarts by grouping them by theirTestProfileandQuarkusTestResourceannotation(s). 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).
Quarkus*Tests with restrictedQuarkusTestResourcecome after tests with profiles and Quarkus*Tests with only unrestricted resources are handled like tests without a profile (come first). Internally, ordering is based on prefixes that are prepended to a secondary order suffix (by default the fully qualified name of the respective test 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_. The secondary order suffix can be changed via "junit.quarkus.orderer.secondary-orderer", e.g. a value oforg.junit.jupiter.api.ClassOrderer$Randomwill order the test classes within one group randomly instead by class name.getCustomOrderKey(ClassDescriptor, ClassOrdererContext)can be overridden to provide a custom order number for a given test class, e.g. based onTagor something else. Limitations:- Only JUnit5 test classes are subject to ordering, e.g. ArchUnit test classes are not passed to this orderer.
- This orderer does not handle
Nestedtest classes.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static String_CFGKEY_ORDER_PREFIX_NON_QUARKUS_TESTDeprecated, for removal: This API element is subject to removal in a future version.(package private) static String_CFGKEY_ORDER_PREFIX_QUARKUS_TESTDeprecated, for removal: This API element is subject to removal in a future version.(package private) static String_CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILEDeprecated, for removal: This API element is subject to removal in a future version.(package private) static String_CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_RESTRICTED_RESDeprecated, for removal: This API element is subject to removal in a future version.(package private) static String_CFGKEY_SECONDARY_ORDERERDeprecated, for removal: This API element is subject to removal in a future version.(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_PROFILE(package private) static StringCFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_RESTRICTED_RES(package private) static StringCFGKEY_SECONDARY_ORDERERprotected static StringDEFAULT_ORDER_PREFIX_NON_QUARKUS_TESTprotected static StringDEFAULT_ORDER_PREFIX_QUARKUS_TESTprotected static StringDEFAULT_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILEprotected static StringDEFAULT_ORDER_PREFIX_QUARKUS_TEST_WITH_RESTRICTED_RES
-
Constructor Summary
Constructors Constructor Description QuarkusTestProfileAwareClassOrderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Optional<String>getCustomOrderKey(org.junit.jupiter.api.ClassDescriptor classDescriptor, org.junit.jupiter.api.ClassOrdererContext context)Deprecated, for removal: This API element is subject to removal in a future version.protected Optional<String>getCustomOrderKey(org.junit.jupiter.api.ClassDescriptor classDescriptor, org.junit.jupiter.api.ClassOrdererContext context, String secondaryOrderSuffix)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_QUARKUS_TEST_WITH_RESTRICTED_RES
protected static final String DEFAULT_ORDER_PREFIX_QUARKUS_TEST_WITH_RESTRICTED_RES
- 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
@Deprecated(forRemoval=true, since="2.7.0.CR1") static final String _CFGKEY_ORDER_PREFIX_QUARKUS_TEST
Deprecated, for removal: This API element is subject to removal in a future version.- 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_QUARKUS_TEST_WITH_PROFILE
@Deprecated(forRemoval=true, since="2.7.0.CR1") static final String _CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_PROFILE
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_RESTRICTED_RES
static final String CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_RESTRICTED_RES
- See Also:
- Constant Field Values
-
_CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_RESTRICTED_RES
@Deprecated(forRemoval=true, since="2.7.0.CR1") static final String _CFGKEY_ORDER_PREFIX_QUARKUS_TEST_WITH_RESTRICTED_RES
Deprecated, for removal: This API element is subject to removal in a future version.- 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
-
_CFGKEY_ORDER_PREFIX_NON_QUARKUS_TEST
@Deprecated(forRemoval=true, since="2.7.0.CR1") static final String _CFGKEY_ORDER_PREFIX_NON_QUARKUS_TEST
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
CFGKEY_SECONDARY_ORDERER
static final String CFGKEY_SECONDARY_ORDERER
- See Also:
- Constant Field Values
-
_CFGKEY_SECONDARY_ORDERER
@Deprecated(forRemoval=true, since="2.8.0.Final") static final String _CFGKEY_SECONDARY_ORDERER
Deprecated, for removal: This API element is subject to removal in a future version.- 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
@Deprecated(forRemoval=true, since="2.7.0.CR1") protected Optional<String> getCustomOrderKey(org.junit.jupiter.api.ClassDescriptor classDescriptor, org.junit.jupiter.api.ClassOrdererContext context)
Deprecated, for removal: This API element is subject to removal in a future version.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
-
getCustomOrderKey
protected Optional<String> getCustomOrderKey(org.junit.jupiter.api.ClassDescriptor classDescriptor, org.junit.jupiter.api.ClassOrdererContext context, String secondaryOrderSuffix)
Template method that provides an optional custom order key for the givenclassDescriptor.- Parameters:
classDescriptor- the respective test classcontext- for config lookupsecondaryOrderSuffix- the secondary order suffix that was calculated by the secondary orderer- Returns:
- optional custom order key for the given test class
-
-