Skip to content

Result Manager models

Test Result model

UML Diagram

TestResult

Bases: BaseModel

Describe the result of a test from a single device.

Attributes:

Name Type Description
name Device name where the test has run.

test: Test name runs on the device. categories: List of categories the TestResult belongs to, by default the AntaTest categories. description: TestResult description, by default the AntaTest description. result: Result of the test. Can be one of “unset”, “success”, “failure”, “error” or “skipped”. messages: Message to report after the test if any. custom_field: Custom field to store a string for flexibility in integrating with ANTA

is_error

is_error(message: str | None = None) -> None

Set status to error.

Args:
message: Optional message related to the test
Source code in anta/result_manager/models.py
66
67
68
69
70
71
72
73
74
def is_error(self, message: str | None = None) -> None:
    """Set status to error.

    Args:
    ----
        message: Optional message related to the test

    """
    self._set_status("error", message)

is_failure

is_failure(message: str | None = None) -> None

Set status to failure.

Args:
message: Optional message related to the test
Source code in anta/result_manager/models.py
46
47
48
49
50
51
52
53
54
def is_failure(self, message: str | None = None) -> None:
    """Set status to failure.

    Args:
    ----
        message: Optional message related to the test

    """
    self._set_status("failure", message)

is_skipped

is_skipped(message: str | None = None) -> None

Set status to skipped.

Args:
message: Optional message related to the test
Source code in anta/result_manager/models.py
56
57
58
59
60
61
62
63
64
def is_skipped(self, message: str | None = None) -> None:
    """Set status to skipped.

    Args:
    ----
        message: Optional message related to the test

    """
    self._set_status("skipped", message)

is_success

is_success(message: str | None = None) -> None

Set status to success.

Args:
message: Optional message related to the test
Source code in anta/result_manager/models.py
36
37
38
39
40
41
42
43
44
def is_success(self, message: str | None = None) -> None:
    """Set status to success.

    Args:
    ----
        message: Optional message related to the test

    """
    self._set_status("success", message)