Juggernaut.Report.Data (Juggernaut v0.4.0)

Copy Markdown View Source

The data document the HTML dashboard embeds (mix juggernaut.report, design notes §11).

Every figure is taken from, or counted from, what was recorded: the selected run (its mutants, results, phases and summary), the run before it (to tell new survivors from ones already there) and the history records (trends and phase clocks over runs). The page's script only lays these figures out; it computes nothing that is shown as a number except formatting. Each section names its basis: measured (by the selected run), recorded (by the run a reused result came from, or by earlier runs in the history) or counted (from the recorded statuses). Nothing is estimated.

The document is %{format: 1, kind: "report", ...}; Juggernaut.Report.Html encodes it.

Each test a mutant ran is written once, in test_refs (sorted by id, then name): a mutant's tests and killed_by are [index, duration_ms, outcome] into it. A run whose suite selections each ran hundreds of tests otherwise repeats every name and file once per mutant (a large Phoenix app's 2067-mutant run made a 39.5 MB page). A test is keyed by its id and its name together: an id is only file:line, so tests a loop defines share one.

Summary

Types

What the document is built from: the run shown, the run recorded before it (or nil), the history records (oldest first, already limited) and the view options (thresholds, timeouts, sources).

Functions

The data document for inputs.

Whether a result ran a job in its run: a selection other than none, not reused.

One mutant as the inspector shows it. shown is how the survivor list shows it (survived, no_coverage, timeout when timeouts are scored as survived) or the recorded status; new is true for a survivor the previous run did not have, false for one it had, and nil when it is not a survivor or there is no previous run. index maps a test, as {id, name} with the name a string, to its place in the document's test_refs.

A test reference as the page shows it.

Types

inputs()

@type inputs() :: %{
  run: Juggernaut.Run.t(),
  previous: Juggernaut.Run.t() | nil,
  history: [map()],
  options: Juggernaut.View.options()
}

What the document is built from: the run shown, the run recorded before it (or nil), the history records (oldest first, already limited) and the view options (thresholds, timeouts, sources).

Functions

build(inputs)

@spec build(inputs()) :: map()

The data document for inputs.

job?(result)

@spec job?(Juggernaut.Result.t()) :: boolean()

Whether a result ran a job in its run: a selection other than none, not reused.

mutant(run, m, new_keys, options, index)

@spec mutant(
  Juggernaut.Run.t(),
  Juggernaut.Mutant.t(),
  MapSet.t() | nil,
  Juggernaut.View.options(),
  %{required({String.t(), String.t()}) => integer()}
) :: map()

One mutant as the inspector shows it. shown is how the survivor list shows it (survived, no_coverage, timeout when timeouts are scored as survived) or the recorded status; new is true for a survivor the previous run did not have, false for one it had, and nil when it is not a survivor or there is no previous run. index maps a test, as {id, name} with the name a string, to its place in the document's test_refs.

test_ref(test)

@spec test_ref(Juggernaut.TestRef.t()) :: map()

A test reference as the page shows it.