test - Reporting results and logging
Common test utilities.
This module provides utility functions for test cases, including logging, verification.
- get_current_test_case_name() str
The name of the current test case.
- Raises:
InternalError – If no test is running.
- log(message: str) None
Log the given message with the level ‘INFO’.
- Parameters:
message (str) – String representing the message to log.
- Raises:
InternalError – If no test is running.
- log_debug(message: str) None
Log the given message with the level ‘DEBUG’.
- Parameters:
message (str) – String representing the message to log.
- Raises:
InternalError – If no test is running.
- verify(condition: bool, failure_description: str) None
Verify condition and handle failures.
When condition is
False, raise an exception and log the last 10 commands executed on both the SUT and TG.- Parameters:
condition (bool) – The condition to check.
failure_description (str) – A short description of the failure that will be stored in the raised exception.
- Raises:
TestCaseVerifyError – If condition is
False.
- verify_else_skip(condition: bool, skip_reason: str) None
Verify condition and handle skips.
When condition is
False, raise a skip exception.- Parameters:
condition (bool) – The condition to check.
skip_reason (str) – Description of the reason for skipping.
- Raises:
SkippedTestException – If condition is
False.
- skip(skip_description: str) None
Skip the current test case or test suite with a given description.
- Parameters:
skip_description (str) – Description of the reason for skipping.
- Raises:
SkippedTestException – Always raised to indicate the test was skipped.
- fail(failure_description: str) None
Fail the current test case with a given description.
Logs the last 10 commands executed on both the SUT and TG before raising an exception.
- Parameters:
failure_description (str) – Description of the reason for failure.
- Raises:
TestCaseVerifyError – Always raised to indicate the test case failed.
- get_logger() DTSLogger
Get a logger instance for tests.
- Raises:
InternalError – If no test is running.