-
Notifications
You must be signed in to change notification settings - Fork 2
Outcome
The outcome of running a test.
public struct Outcome
Whether the test passed or failed.
let ok: Bool
From the TAP v13 specification:
This tells whether the test point passed or failed. It must be at the beginning of the line.
/^not ok/
indicates a failed test point./^ok/
is a successful test point. This is the only mandatory part of the line. Note that unlike the Directives below, ok and not ok are case-sensitive.
A description of the tested behavior.
let description: String?
From the TAP v13 specification:
Any text after the test number but before a
#
is the description of the test point.
ok 42 this is the description of the test
Descriptions should not begin with a digit so that they are not confused with the test point number. The harness may do whatever it wants with the description.
A directive for how to interpret a test outcome.
let directive: Directive?
From the TAP v13 specification:
The test point may include a directive, following a hash on the test line. There are currently two directives allowed:
TODO
andSKIP
.
Additional information about a test, such as its source location (file / line) or the actual and expected results.
let metadata: [String: Any]?
Test outcome metadata is encoded as YAML.
From the TAP v13 specification:
If the test line is immediately followed by an indented block beginning with
/^\s+---/
and ending with/^\s+.../
that block will be interpreted as an inline YAML document. The YAML encodes a data structure that provides more detailed information about the preceding test. The YAML document is indented to make it visually distinct from the surrounding test results and to make it easier for the parser to recover if the trailing ‘…’ terminator is missing. For example:message: "Failed with error 'hostname peebles.example.com not found'" severity: fail data: got: hostname: 'peebles.example.com' address: ~ expected: hostname: 'peebles.example.com' address: '85.193.201.85' ...
Creates a successful test outcome.
public static func success(_ description: String? = nil, directive: Directive? = nil, metadata: [String: Any]? = nil) -> Outcome
- description: A description of the tested behavior.
nil
by default. - directive: A directive for how to interpret a test outcome.
nil
by default. - metadata: Additional information about a test.
nil
by default.
A successful test outcome.
Creates an unsuccessful test outcome.
public static func failure(_ description: String? = nil, directive: Directive? = nil, metadata: [String: Any]? = nil) -> Outcome
- description: A description of the tested behavior.
nil
by default. - directive: A directive for how to interpret a test outcome.
nil
by default. - metadata: Additional information about a test.
nil
by default.
An unsuccessful test outcome.
Generated at 2021-01-08T14:13:00+0000 using swift-doc 1.0.0-beta.5.