Mojo struct
TestReport
struct TestReport
A report for a single unit test.
Fields
- name (
StringSlice[StaticConstantOrigin]): 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 = True
Methods
passed
static passed(*, name: StringSlice[StaticConstantOrigin], duration_ns: UInt) -> Self
Create a passing test report.
Args:
- name (
StringSlice): The name of the test. - duration_ns (
UInt): The duration of the test in nanoseconds.
Returns:
Self: A new passing test report.
failed
static failed(*, name: StringSlice[StaticConstantOrigin], duration_ns: UInt, var error: Error) -> Self
Create a failing test report.
Args:
- name (
StringSlice): 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(*, name: StringSlice[StaticConstantOrigin]) -> Self
Create a skipped test report.
Args:
- name (
StringSlice): 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.
Args:
- writer (
T): The writer to output the formatted report to.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!