Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25751

Allow sharing the @UITest configuration between functional test classes through a common base class

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 18.10.0-rc-1
    • 17.10.15
    • Test Framework
    • None
    • Unknown

    Description

      Problem

      The @UITest annotation is not @Inherited, and XWikiDockerExtension reads it with Class#getAnnotation() on the test class being executed. As a consequence, a top-level functional test class whose @UITest configuration is declared only on its (abstract) base class can't be run on its own: the configuration (properties, extra JARs, network aliases, etc.) declared on the base class is not found.

      So a module that has several functional test classes sharing the same setup (e.g. extending a common abstract class and aggregated by an AllIT with @Nested classes) has to duplicate the same @UITest(...) configuration on each test class, in order for each of them to be runnable individually with -Dit.test=SomeIT. Besides the duplication, this makes it easy for the configurations to drift apart, which prevents reusing the XWiki instance started for one test class to run another test class from the same module (-Dit.test=OtherIT -Dxwiki.test.ui.servletEngine=external).

      Note that the @Nested test classes from AllIT already look for @UITest on their superclasses when the configurations are merged; only the lookup on the top-level test class doesn't.

      Proposal

      Mark @UITest as @Inherited, so that the configuration can be declared once, on the shared base class, and is used both when the test classes are run individually and when they are run from AllIT.

      Attachments

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: