Module bdd

sismic.bdd.execute_bdd(statechart, feature_filepaths, *, step_filepaths=None, property_statecharts=None, interpreter_klass=<class 'sismic.interpreter.default.Interpreter'>, debug_on_error=False, behave_parameters=None)

Execute BDD tests for a statechart.

Parameters:
  • statechart (Statechart) – statechart to test
  • feature_filepaths (List[str]) – list of filepaths to feature files.
  • step_filepaths (Optional[List[str]]) – list of filepaths to step definitions.
  • property_statecharts (Optional[List[Statechart]]) – list of property statecharts
  • interpreter_klass (Callable[[Statechart], Interpreter]) – a callable that accepts a statechart and returns an Interpreter
  • debug_on_error (bool) – set to True to drop to (i)pdb in case of error.
  • behave_parameters (Optional[List[str]]) – additional CLI parameters used by Behave (see http://behave.readthedocs.io/en/latest/behave.html#command-line-arguments)
Return type:

int

Returns:

exit code of behave CLI.

sismic.bdd.map_action(step_text, existing_step_or_steps)

Map new “given”/”when” steps to one or many existing one(s). Parameters are propagated to the original step(s) as well, as expected.

Examples:

  • map_action(‘I open door’, ‘I send event open_door’)
  • map_action(‘Event {name} has to be sent’, ‘I send event {name}’)
  • map_action(‘I do two things’, [‘First thing to do’, ‘Second thing to do’])
Parameters:
  • step_text (str) – Text of the new step, without the “given” or “when” keyword.
  • existing_step_or_steps (Union[str, List[str]]) – existing step, without the “given” or “when” keyword. Could be a list of steps.
Return type:

None

sismic.bdd.map_assertion(step_text, existing_step_or_steps)

Map a new “then” step to one or many existing one(s). Parameters are propagated to the original step(s) as well, as expected.

map_assertion(‘door is open’, ‘state door open is active’) map_assertion(‘{x} seconds elapsed’, ‘I wait for {x} seconds’) map_assertion(‘assert two things’, [‘first thing to assert’, ‘second thing to assert’])

Parameters:
  • step_text (str) – Text of the new step, without the “then” keyword.
  • existing_step_or_steps (Union[str, List[str]]) – existing step, without “then” keyword. Could be a list of steps.
Return type:

None