BuildkiteTestCollector.TestResult (buildkite_test_collector v0.3.1)

Information about in individual test execution.

Contains the details needed to process the analytics for the test, such as success/failure, failure reason, trace, etc.

Summary

Types

More information about a test failure, if available

The test run timing and tracing

A tracing span

t()

Individual test summary. Spec as yet unconfirmed.

Functions

Add a tracing span to the test result history.

Convert the test result into a map ready for serialisation to JSON.

Convert an ExUnit.Test into a Buildkite Test Analytics datum.

Types

expanded_failure()

@type expanded_failure() :: %{expanded: [String.t()], backtrace: [String.t()]}

More information about a test failure, if available

history()

@type history() :: %{
  :start_at => BuildkiteTestCollector.Instant.t(),
  :end_at => BuildkiteTestCollector.Instant.t(),
  :duration => number(),
  :children => [span()],
  optional(:detail) => map()
}

The test run timing and tracing

span()

@type span() :: %{
  :section => :http | :sql | :sleep | :annotation,
  :duration => BuildkiteTestCollector.Duration.t(),
  optional(:start_at) => BuildkiteTestCollector.Instant.t(),
  optional(:end_at) => BuildkiteTestCollector.Instant.t(),
  optional(:detail) => String.t()
}

A tracing span

t()

@type t() :: %BuildkiteTestCollector.TestResult{
  failure_expanded: nil | expanded_failure(),
  failure_reason: nil | String.t(),
  file_name: String.t(),
  history: history(),
  id: Ecto.UUID.t(),
  location: term(),
  name: String.t(),
  result: String.t(),
  scope: String.t()
}

Individual test summary. Spec as yet unconfirmed.

Functions

add_span(test_result, span)

@spec add_span(t(), span()) :: t()

Add a tracing span to the test result history.

as_json(test_result, started_at)

@spec as_json(t(), BuildkiteTestCollector.Instant.t()) :: map()

Convert the test result into a map ready for serialisation to JSON.

This is done as a separate step because all timings are relative to the payload start time, so must be calculated.

new(test, start_time \\ nil)

@spec new(ExUnit.Test.t(), BuildkiteTestCollector.Instant.t() | nil) :: t()

Convert an ExUnit.Test into a Buildkite Test Analytics datum.