AssertionsΒΆ
The scenario framework comes with a rich set of assertion methods, dealing with:
Equalities, inequalities and comparisons,
Nonevalues, object references and types,Strings and regular expressions,
Sets of values (lists or tuples),
Times v/s step executions,
JSON data,
Files and directories.
For the full list of assertion methods,
please refer to the detailed documentation of the Assertions class
which defines them.
It constitutes a base class for common classes like
ScenarioDefinition and StepDefinition.
All assertion methods generally have the following parameters:
errThe
errmessage is the same as the optional message ofunittestassertion methods.It gives the opportunity to explicitize the error message when the assertion fails.
evidenceThe
evidenceparameter may be either a boolean or a string value.When this parameter is set with a
True-like value, evidence is automatically stored with the data used for the assertion when it succeeds:Set it to
Trueto use the default evidence message only.Set it with a string to specialize the evidence message.
unittest assertions
scenario assertions take great inspiration from the well known unittest module.
All unittest assertions methods may not have their equivalent in the Assertions class.
In case you need one of these, the unittest object makes it available.