Class ImportJUnitXmlReports

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.gradle.develocity.agent.gradle.test.ImportJUnitXmlReports
All Implemented Interfaces:
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 Details

    • LOGGER

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

    • ImportJUnitXmlReports

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

    • getDialect

      @Input public abstract Property<JUnitXmlDialect> getDialect()
      Configures the JUnit XML dialect.
      See Also:
    • getReports

      @Internal public abstract ConfigurableFileCollection getReports()
      The JUnit XML report files that should be imported.
    • 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<String> getReferenceTaskBuildPath()
    • getReferenceTaskTaskPath

      @Internal public abstract Property<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.