Contents

XCTExpectFailure(_:enabled:strict:issueMatcher:)

Instructs the test to expect a failure in an upcoming assertion, with parameters to customize expected failure checking and handling.

Declaration

func XCTExpectFailure(_ failureReason: String? = nil, enabled: Bool? = nil, strict: Bool? = nil, issueMatcher: ((XCTIssue) -> Bool)? = nil)

Parameters

  • failureReason:

    An optional string that describes why the test expects a failure.

  • enabled:

    A Boolean value that indicates whether the test checks for the expected failure.

  • strict:

    A Boolean value that indicates whether the test reports an error if the expected failure doesn’t occur.

  • issueMatcher:

    A block of code that determines whether the test issue fulfills the expected failure.

See Also

Expected Failures