Class QuarkusTestProfileAwareClassOrderer

  • All Implemented Interfaces:
    org.junit.jupiter.api.ClassOrderer

    public class QuarkusTestProfileAwareClassOrderer
    extends Object
    implements org.junit.jupiter.api.ClassOrderer
    A ClassOrderer that orders QuarkusTest and QuarkusIntegrationTest classes for minimum Quarkus restarts by grouping them by their TestProfile.

    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 the QuarkusTestProfile as an infix (if present). The default prefixes are defined by DEFAULT_ORDER_PREFIX_* and can be overridden in junit-platform.properties via CFGKEY_ORDER_PREFIX_*, e.g. non-Quarkus tests can be run first (not last) by setting CFGKEY_ORDER_PREFIX_NON_QUARKUS_TEST to 10_.

    getCustomOrderKey(ClassDescriptor, ClassOrdererContext) can be overridden to provide a custom order number for a given test class, e.g. based on Tag, class name or something else.

    Limitations:

    • Constructor Detail

      • QuarkusTestProfileAwareClassOrderer

        public QuarkusTestProfileAwareClassOrderer()
    • Method Detail

      • orderClasses

        public void orderClasses​(org.junit.jupiter.api.ClassOrdererContext context)
        Specified by:
        orderClasses in interface org.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 given classDescriptor.
        Parameters:
        classDescriptor - the respective test class
        context - for config lookup
        Returns:
        optional custom order key for the given test class