XTR Generic Apis

Overview

XTR has its own generic APIs that can be used with unittest and pytest and are logged in all the reports. All their imports are form xtr

from xtr import STEP, ASSERT, EXPECT, get_data_logger

STEP

STEP is similar to info logger. Its signature is:

STEP(name: str, message: str, requirement: str | List[str] = None)

ASSERT

ASSERT represents assertTrue in unittest. It evaluates the given expression an argument. and is used when a blocking check is needed. If it fails, execution will stop gracefully with the fail status. Its signature is:

ASSERT(assertion, severity: Severity, message: str, requirement: str | List[str] = None)

EXPECT

Expect represents expectTrue in unittest. It evaluates the given expression as an argument and is used when a non-blocking check is needed. If it fails, execution continues with fail status. Its signture is:

EXPECT(assertion, severity: Severity, message: str, requirement: str | List[str] = None)

DATA LOGGER

The data logger mimics Python’s logger with its levels, but unlike the built-in logger, it is displayed in all reports.

data_logger = get_data_logger()
data_logger.info('Test')
data_logger.debug({'one': 1, 'two': 2})