subui.test_runner module

class subui.test_runner.SubUITestRunner(steps, client, state=None, **kwargs)[source]

Bases: object

SubUI Test Runner.

This is the interface class of the SubUI framework. It runs all of the provided steps in the provided order. Since some steps might need state from previous executed steps, the runner maintains reference to a global state which it then passes to each step during execution.

Variables:
  • steps (collections.OrderedDict) – Test steps to be executed
  • client – Django test client to run tests
  • kwargs (dict) – Additional kwargs given to class. These kwargs will be provided to each step when executed.
  • state (pycontext.context.Context) – State to be shared between test step executions.
Parameters:
  • steps (list, tuple, collections.OrderedDict) – Steps to be executed. Executed in the provided order hence need to be provided in order-maintaining data-structure.
  • client (django.test.client.Client) – Django test Client to query server with
  • state (dict) – State to be shared between step executions. Optional and by default is empty dict.
  • kwargs – Additional kwargs to be passed to each step during initialization if it is not already provided as initialized object.
run()[source]

Run the test runner.

This executes all steps in the order there are defined in SubUITestRunner.steps. Before each step is executed subui.step.TestStep.init() is called providing all the necessary attributes to execute the step like test client, steps, and state).

Returns:Reference to the test runner