Balder Decorators API¶
This is the api documentation of all available Balder decorators.
Decorator @balder.connect(..)¶
- balder.connect(with_device: Type[Device] | str, over_connection: Connection | Type[Connection] | AndConnectionRelation | OrConnectionRelation, self_node_name: str | None = None, dest_node_name: str | None = None)¶
This decorator connects two devices with each other. It can be used for scenarios as well as setup devices.
- Parameters:
with_device – that’s the
Devicethat should be connected to the decorated deviceover_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.
- Parameters:
level – the execution level the fixture should have
Decorator @balder.for_vdevice(..)¶
- balder.for_vdevice(vdevice: str | ~typing.Type[~_balder.vdevice.VDevice], with_connections: ~typing.Type[~_balder.connection.Connection] | ~_balder.connection.Connection | ~_balder.cnnrelations.and_connection_relation.AndConnectionRelation | ~_balder.cnnrelations.or_connection_relation.OrConnectionRelation = <_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
Featureclasses just like single methods of aFeatureclass.- 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.
- Parameters:
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: Type[Scenario] | str | callable | None)¶
This decorator defines that there exists another Scenario class or test method item that has a similar implementation like the decorated
Scenarioclass or the decorated test method.- Parameters:
item – the element which contains the whole implementation of this scenario or test method
Decorator @balder.insert_into_tree(..)¶
- balder.insert_into_tree(parents: List[Type[Connection] | Tuple[Type[Connection]]] | None = None, tree_name: str = '')¶
This decorator inserts a
Connection()object into the global connection tree.- Parameters:
parents – all items that are parents of the decorated connection
tree_name – the tree name the connection should be inserted in
Decorator @balder.parametrize(..)¶
- balder.parametrize(field_name: str, values: Iterable[Any])¶
Allows to parametrize a test function. This decorator will be used to statically parametrize a test function.
- Parameters:
field_name – the field name of the test function
values – an iterable of values, that should be used to parametrize the test function
Decorator @balder.parametrize_by_feature(..)¶
- balder.parametrize_by_feature(field_name: str, feature_accessor: Tuple[Type[Device], str, str], parameter: Dict[str, FeatureAccessSelector | Parameter | Value] = None)¶
Allows to parametrize a test function. This decorator will be used to dynamically parametrize a test function, by the value a setup feature returns before entering the test.
- Parameters:
field_name – the field name of the test function
feature_accessor – a tuple that provides information for accessing the feature
parameter – the parameter to parametrize the feature method (if necessary)