Runbox.Runtime.Stage.Sandbox.TestRunner (runbox v1.2.0)

For new unit testing of scenarios it is recommended to use functions in Runbox.Runtime.Stage.Sandbox directly. This module should only help to convert old scenarios integration tests (using Solutions.TestRunner) to unit tests. For examples of such conversion see tests in the scenarios master branch.

Link to this section Summary

Functions

Runs an unit test according to the test_def definition.

Link to this section Functions

Link to this function

run_test(test_def)

Runs an unit test according to the test_def definition.

Function accepts the same test_def definition as Solutions.TestRunner.run_test/1 with few differences:

  • Only run_options.scenario_id, run_options.start_from, messages and expected_actions properties are used, other properties are ignored.

  • Instead of output log format expected_actions are Toolbox.Scenario.OutputAction structures, for example

    %{
      action: :add_asset,
      params: %{attributes: %{}, id: "/diamonds/O"},
      result: "nil",
      serialization_vector: ["/diamonds/O"],
      side_effects: false,
      timestamp: 1
    }

    must be changed to:

    %OutputAction{
      type: :add_asset,
      body: %Asset{attributes: %{}, id: "/diamonds/O"},
      svector: ["/diamonds/O"],
      timestamp: 1
    }

To see differences take a look at deduplication_diamond_test.exs in scenarios and the same test in solutions.