Package org.gradle.testkit.runner

# Interface BuildResult

public interface BuildResult
The result of executing a build, via the `GradleRunner`.

Since:
  2.6
See Also:
  - `GradleRunner.build()`
  - `GradleRunner.buildAndFail()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getOutput()`
  The textual output produced during the build.
  `BufferedReader`
  `getOutputReader()`
  A new `BufferedReader` of the textual output produced during the build.
  `List<BuildTask>`
  `getTasks()`
  The tasks that were part of the build.
  `@Nullable BuildTask`
  `task(String taskPath)`
  Returns the result object for a particular task, or `null` if the given task was not part of the build.
  `List<String>`
  `taskPaths(TaskOutcome outcome)`
  The paths of the subset of `getTasks()` that had the given outcome.
  `List<BuildTask>`
  `tasks(TaskOutcome outcome)`
  The subset of `getTasks()` that had the given outcome.

- ## Method Details

  - ### getOutput

    String getOutput()
    The textual output produced during the build.

    This is equivalent to the console output produced when running a build from the command line. It contains both the standard output, and standard error output, of the build.

    Returns:
      the build output, or an empty string if there was no build output (e.g. ran with `-q`)
    Since:
      2.9

  - ### getOutputReader

    @Incubating BufferedReader getOutputReader()
    A new `BufferedReader` of the textual output produced during the build.

    This is equivalent to the console output produced when running a build from the command line. It contains both the standard output, and standard error output, of the build.

    The caller is responsible for ensuring that the returned stream is closed.

    Returns:
      a reader of the build output
    Since:
      9.3.0

  - ### getTasks

    List<BuildTask> getTasks()
    The tasks that were part of the build.

    The order of the tasks corresponds to the order in which the tasks were started. If executing a parallel enabled build, the order is not guaranteed to be deterministic.

    The returned list is an unmodifiable view of items. The returned list will be empty if no tasks were executed. This can occur if the build fails early, due to a build script failing to compile for example.

    Returns:
      the build tasks

  - ### tasks

    List<BuildTask> tasks(TaskOutcome outcome)
    The subset of `getTasks()` that had the given outcome.

    The returned list is an unmodifiable view of items. The returned list will be empty if no tasks were executed with the given outcome.

    Parameters:
      `outcome` - the desired outcome
    Returns:
      the build tasks with the given outcome

  - ### taskPaths

    List<String> taskPaths(TaskOutcome outcome)
    The paths of the subset of `getTasks()` that had the given outcome.

    The returned list is an unmodifiable view of items. The returned list will be empty if no tasks were executed with the given outcome.

    Parameters:
      `outcome` - the desired outcome
    Returns:
      the paths of the build tasks with the given outcome

  - ### task

    @Nullable BuildTask task(String taskPath)
    Returns the result object for a particular task, or `null` if the given task was not part of the build.
    Parameters:
      `taskPath` - the path of the target task
    Returns:
      information about the executed task, or `null` if the task was not executed