Juggernaut.TestLanes (Juggernaut v0.4.0)

Copy Markdown View Source

The test lanes of a project (test_lanes in .juggernaut.exs, design notes §10.6): which of its tests are integration tests, and the timeouts each lane is held to.

A test is an integration test when it has one of test_lanes.integration.tags set (to anything but false or nil, as @tag, @describetag or @moduletag set it), or its file matches one of test_lanes.integration.paths; every other test is a unit test. The default is the tag :integration and the directory test/integration/.

A mutant runs its unit tests first and its integration tests only when they all pass (Juggernaut.Runner.Schedule.stages/3): a mutant that only an integration test kills is still killed, and is reported apart (test_lane: :integration in its result), since no unit test would have caught it.

Each lane has its own timeout (E3): the unit lane the top-level timeout, the integration lane test_lanes.integration.timeout, whose keys default to the top-level ones.

Summary

Functions

The integration tests of tests (the boot inventory, %{test_id => test_info}, each with its file and the tags it has set), as a set.

Whether a test (file and set tags) is an integration test under spec.

The timeout config ([multiplier:, min_ms:]) of lane: the top-level timeout, with test_lanes.integration.timeout over it for the integration lane.

Types

lane()

@type lane() :: :unit | :integration

test_id()

@type test_id() :: {module(), atom()}

test_info()

@type test_info() :: %{:file => String.t(), optional(:tags) => [atom()]}

Functions

integration(tests, config)

@spec integration(%{required(test_id()) => test_info()}, Juggernaut.Config.t()) ::
  MapSet.t(test_id())

The integration tests of tests (the boot inventory, %{test_id => test_info}, each with its file and the tags it has set), as a set.

integration?(info, spec)

@spec integration?(test_info(), keyword()) :: boolean()

Whether a test (file and set tags) is an integration test under spec.

timeout(config, atom)

@spec timeout(Juggernaut.Config.t(), lane()) :: [
  multiplier: number(),
  min_ms: pos_integer()
]

The timeout config ([multiplier:, min_ms:]) of lane: the top-level timeout, with test_lanes.integration.timeout over it for the integration lane.