Reports¶
Rendering helpers for SuiteResult — console tables, JSON and JUnit XML.
modeltest.core.report
¶
Report rendering: console table, JSON, and JUnit XML (for CI/CD).
render_report(result, style='table')
¶
Render a SuiteResult in the requested style.
Args:
result: The suite outcome to render.
style: "table" (console, default), "json" or "junit".
Returns: The rendered report as a string.
Raises: ValueError: Via the JSON encoder path if the payload is not serializable (should not happen for standard results).
Source code in modeltest/core/report.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
to_json(result)
¶
Serialize a SuiteResult to a JSON string.
Includes the suite name, aggregate counts and one object per test with name, status, detail, duration and recorded metrics.
Args: result: The suite outcome to serialize.
Returns: Pretty-printed JSON (2-space indent).
Source code in modeltest/core/report.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
to_junit_xml(result)
¶
Serialize a SuiteResult to JUnit XML.
The output wraps everything in the standard <testsuites> element
expected by CI test reporters (GitHub Actions, Jenkins, GitLab...):
FAILED tests become <failure> nodes, ERROR tests <error>.
Args: result: The suite outcome to serialize.
Returns: The XML document as a string.
Source code in modeltest/core/report.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |