Mojo struct
TestReport
struct TestReport
A report for a single unit test.
Fields
- name (
String
): The name of the test. - duration_ns (
UInt
): The duration of the test in nanoseconds. - result (
TestResult
): The result code of the test. - error (
Error
): The error associated with a failing test.
Implemented traits
AnyType
,
Copyable
,
Movable
,
UnknownDestructibility
,
Writable
Aliases
__copyinit__is_trivial
alias __copyinit__is_trivial = False
__del__is_trivial
alias __del__is_trivial = False
__moveinit__is_trivial
alias __moveinit__is_trivial = False
Methods
passed
static passed(*, var name: String, duration_ns: UInt) -> Self
Create a passing test report.
Args:
Returns:
Self
: A new passing test report.
failed
static failed(*, var name: String, duration_ns: UInt, var error: Error) -> Self
Create a failing test report.
Args:
- name (
String
): The name of the test. - duration_ns (
UInt
): The duration of the test in nanoseconds. - error (
Error
): The error raised by the failing test.
Returns:
Self
: A new failing test report.
skipped
static skipped(*, var name: String) -> Self
Create a skipped test report.
Args:
- name (
String
): The name of the test.
Returns:
Self
: A new skipped test report.
write_to
write_to(self, mut writer: T)
Write the formatted test report to the writer.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!