Class ImportJUnitXmlReports

  • All Implemented Interfaces:
    java.lang.Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, Named, ExtensionAware, Task, Configurable<Task>

    public abstract class ImportJUnitXmlReports
    extends DefaultTask
    Imports JUnit XML reports into the build's Develocity build scan.
    Since:
    3.17
    • Field Detail

      • LOGGER

        protected static final org.slf4j.Logger LOGGER
    • Constructor Detail

      • ImportJUnitXmlReports

        @Inject
        public ImportJUnitXmlReports​(org.gradle.internal.operations.BuildOperationListenerManager listenerManager,
                                     org.gradle.internal.scan.time.BuildScanClock clock,
                                     ObjectFactory objectFactory,
                                     Gradle gradle)
    • Method Detail

      • getReferenceTask

        @Internal
        @Nullable
        public @Nullable Property<Task> getReferenceTask()
        The reference task to which the tests should be attributed.

        Can be omitted, in which case the tests will be attributed to the import task.

      • getReferenceTaskBuildPath

        @Internal
        public abstract Property<java.lang.String> getReferenceTaskBuildPath()
      • getReferenceTaskTaskPath

        @Internal
        public abstract Property<java.lang.String> getReferenceTaskTaskPath()
      • register

        public static TaskProvider<ImportJUnitXmlReports> register​(TaskContainer tasks,
                                                                   TaskProvider<?> testTask,
                                                                   JUnitXmlDialect dialect)
        Helper method to lazily register and configure an import task.

        
         afterEvaluate {
             ImportJUnitXmlReports.register(tasks, tasks.named("connectedDebugAndroidTest"), com.gradle.scan.plugin.test.JUnitXmlDialect.ANDROID_CONNECTED)
         }
         

        Or if the given task doesn't declare the outputs automatically, we can specify the reports explicitly, for example:

        
         afterEvaluate {
             ImportJUnitXmlReports.register(tasks, tasks.named("execFlank"), com.gradle.scan.plugin.test.JUnitXmlDialect.ANDROID_FIREBASE)
                 .configure { reports.from(file("${buildDir}/fladle/outputs/JUnitReport.xml")) }
         }
         

        The resulting task uses the name of the supplied testTask appended with the "ImportJUnitXmlReports" suffix, will scan its output files for JUnit XML reports, and run as one of its finalizer tasks.

        Parameters:
        tasks - the gradle task container, i.e., project.tasks
        testTask - the task that produces the JUnit XML, the tests will also be attributed to this task
        dialect - the dialect of the JUnit XML, see JUnitXmlDialect for more information.
        Returns:
        the task provider, can be used to manually set the report files for tasks that don't declare outputs.