Other reporters
Report management for ANTA.
ReportJinja ¶
ReportJinja(template_path: pathlib.Path)
Report builder based on a Jinja2 template.
Source code in anta/reporter/__init__.py
233 234 235 236 237 238 239 |
|
render ¶
render(
data: list[dict[str, Any]],
*,
trim_blocks: bool = True,
lstrip_blocks: bool = True
) -> str
Build a report based on a Jinja2 template.
Report is built based on a J2 template provided by user. Data structure sent to template is:
Example
>>> print(ResultManager.json)
[
{
name: ...,
test: ...,
result: ...,
messages: [...]
categories: ...,
description: ...,
}
]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
list[dict[str, Any]]
|
List of results from |
required |
trim_blocks |
bool
|
enable trim_blocks for J2 rendering. |
True
|
lstrip_blocks |
bool
|
enable lstrip_blocks for J2 rendering. |
True
|
Returns:
Type | Description |
---|---|
str
|
Rendered template |
Source code in anta/reporter/__init__.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
|
ReportTable ¶
TableReport Generate a Table based on TestResult.
Headers
dataclass
¶
Headers(
device: str = "Device",
test_case: str = "Test Name",
number_of_success: str = "# of success",
number_of_failure: str = "# of failure",
number_of_skipped: str = "# of skipped",
number_of_errors: str = "# of errors",
list_of_error_nodes: str = "List of failed or error nodes",
list_of_error_tests: str = "List of failed or error test cases",
)
Headers for the table report.
report_all ¶
report_all(
manager: ResultManager, title: str = "All tests results"
) -> Table
Create a table report with all tests for one or all devices.
Create table with full output: Device | Test Name | Test Status | Message(s) | Test description | Test category
Parameters:
Name | Type | Description | Default |
---|---|---|---|
manager |
ResultManager
|
A ResultManager instance. |
required |
title |
str
|
Title for the report. Defaults to ‘All tests results’. |
'All tests results'
|
Returns:
Type | Description |
---|---|
Table
|
A fully populated rich |
Source code in anta/reporter/__init__.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
report_summary_devices ¶
report_summary_devices(
manager: ResultManager,
devices: list[str] | None = None,
title: str = "Summary per device",
) -> Table
Create a table report with result aggregated per device.
Create table with full output: Device | # of success | # of skipped | # of failure | # of errors | List of failed or error test cases
Parameters:
Name | Type | Description | Default |
---|---|---|---|
manager |
ResultManager
|
A ResultManager instance. |
required |
devices |
list[str] | None
|
List of device names to include. None to select all devices. |
None
|
title |
str
|
Title of the report. |
'Summary per device'
|
Returns:
Type | Description |
---|---|
Table
|
A fully populated rich |
Source code in anta/reporter/__init__.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
report_summary_tests ¶
report_summary_tests(
manager: ResultManager,
tests: list[str] | None = None,
title: str = "Summary per test",
) -> Table
Create a table report with result aggregated per test.
Create table with full output: Test Name | # of success | # of skipped | # of failure | # of errors | List of failed or error nodes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
manager |
ResultManager
|
A ResultManager instance. |
required |
tests |
list[str] | None
|
List of test names to include. None to select all tests. |
None
|
title |
str
|
Title of the report. |
'Summary per test'
|
Returns:
Type | Description |
---|---|
Table
|
A fully populated rich |
Source code in anta/reporter/__init__.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|