Base Tests
mercury.robust.basetests
RobustTest(name=None, *args, **kwargs)
Bases: ABC
Base class for the robust testing implementations. It keeps three attributes:
1) `_name` (str): name of the test. It can be specified when constructing the test, otherwise
it will take the name of the class.
2) `_state `(TestState): state in which the test is found. Initially, NOT_EXECUTED
3) `_error_message` (str): After running the test, this contains an error message if the
test fails or runs an exception
Source code in mercury/robust/basetests.py
37 38 39 40 |
|
run(*args, **kwargs)
Run the test, raising FailedTestError exception if it fails It must be implemented in subclasses
Source code in mercury/robust/basetests.py
64 65 66 67 68 69 |
|
run_safe(*args, **kwargs)
Runs the test without raising FailedTestError exception. Instead, the attribute
_state
will store the state that has reached the test, and the attribute
_error_message
will contain a message in case that an error happens.
Source code in mercury/robust/basetests.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
TestState
Bases: Enum
Enumeration class with the different states that a Test can be.