Balder Decorators API

This is the api documentation of all available Balder decorators.

Decorator @balder.connect(..)

balder.connect(with_device: Union[Type[_balder.device.Device], str], over_connection: Union[Type[_balder.connection.Connection], _balder.connection.Connection], self_node_name: Optional[str] = None, dest_node_name: Optional[str] = None)

This decorator connects two devices with each other. It can be used for scenarios as well as setup devices.

  • with_device – that’s the Device that should be connected to the decorated device

  • over_connection – that’s the connection tree that should connect the devices with each other

  • self_node_name – the node name of this device (if this param is not given, balder automatically generates a new node name in format n{unique device counter})

  • dest_node_name – the node name of the destination device, given with with_device (if this param is not given, balder automatically generates a new node name in format n{unique device counter})

Decorator @balder.fixture(..)

balder.fixture(level: Literal['session', 'setup', 'scenario', 'variation', 'testcase'])

This decorator declares the decorated function/method as a fixture function/method.


level – the execution level the fixture should have

Decorator @balder.for_vdevice(..)

balder.for_vdevice(vdevice: Union[str, _balder.device.Device], with_connections: Union[Type[_balder.connection.Connection], _balder.connection.Connection, Tuple[Union[Type[_balder.connection.Connection], _balder.connection.Connection]], List[Union[Type[_balder.connection.Connection], _balder.connection.Connection, Tuple[Union[Type[_balder.connection.Connection], _balder.connection.Connection]]]]] = <_balder.connection.Connection object>)

With the @for_vdevice you can limit the decorated object for a special allowed connection tree for every existing vDevice. This decorator can be used to decorate whole Feature classes just like single methods of a Feature class.

Decorated Feature classes: This controls the allowed sub-connection tree between the mapped device of the given

vDevice and the device class that uses the decorated feature. If the defined sub-tree does not match the sub-tree that connects the both devices with each other on the setup level, the feature can not be applied.

Decorated Feature method: Similar to the class based decoration, you can specify if a method is executable with

the given sub-tree. Especially, at this point you are able to define your own method variations. Balder will select the chosen one depending on the matching connection sub-tree.

You can find more about this in the documentation chapter VDevices and method-variations.

  • vdevice – the vDevice this decorator should describe

  • with_connections – the assigned connection trees for this class/method (default: a universal connection)

Decorator @balder.covered_by(..)

balder.covered_by(item: Optional[Union[Type[_balder.scenario.Scenario], callable]])

This decorator defines that there exists another Scenario class or test method item that has a similar implementation like the decorated Scenario class or the decorated test method.


item – the element which contains the whole implementation of this scenario or test method

Decorator @balder.insert_into_tree(..)

balder.insert_into_tree(parents: Optional[List[Union[Type[_balder.connection.Connection], Tuple[Type[_balder.connection.Connection]]]]] = None, tree_name: str = '')

This decorator inserts a Connection() object into the global connection tree.

  • parents – all items that are parents of the decorated connection

  • tree_name – the tree name the connection should be inserted in