View Source Runbox.Runtime.Stage.Sandbox.TestRunner (runbox v13.0.3)

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.

Summary

Functions

Runs an unit test according to the test_def definition.

Functions

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 Runbox.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:

    %Runbox.Scenario.OutputAction{
      body: %Runbox.Scenario.OutputAction.UpsertAssetAttributes{
        type: "/diamonds",
        id: "O", attributes: %{}
      },
      timestamp: 1
    }

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