View Source Runbox.Runtime.Simple.Sandbox (runbox v13.0.3)

Sandbox is a helper for executing runs without started Altworx application.

Sandbox can be used for scenarios unit testing and also for interactive development, e.g. in LiveBook.

This module is only for Simple scenarios.

For interactive development of scenarios, run iex --erl "-runbox mode slave" -S mix from command line in your scenarios application root directory and then use Sandbox functions to execute your runs (of course use recompile before run execution if you changed scenario code).

Summary

Functions

Starts a new run for scenario_id and processes all input messages.

Functions

Link to this function

execute_run(topics, scenario_id, opts \\ [])

View Source
@spec execute_run(
  Runbox.Runtime.Sandbox.topics(),
  scenario_id :: String.t(),
  Runbox.Runtime.Sandbox.opts()
) :: {:ok, [Runbox.Scenario.OutputAction.t()]} | {:error, any()}

Starts a new run for scenario_id and processes all input messages.

Returns all output actions generated by run execution. Input messages for each runtime topic, referenced by its logical name, are passed in the topics argument. Undefined topics are considered empty.

There are few options that can be specified.

  • :start_from - specify the start from value for the run. The value is used to filter out messages and is passed to the scenario's init callback.
  • :modules - list of modules containing the scenario (manifest and template, which can be just one module). If not specified, modules are auto-discovered from the current Mix app. This opens up the possibility to write ad-hoc scenarios with only Runbox as dependency, e.g. in Livebook.