Swift

Swift

Made by DeepSource

An XCTFail call should include a description of the assertion SW-R1032

Anti-pattern
Major

When a test case fails, the XCTFail call is used to indicate the failure. However, without a description, it becomes challenging to determine the specific reason for the failure. This can lead to confusion and increase debugging time, especially when multiple assertions are present in the same test case.

It is recommended to always include a descriptive message when using XCTFail to provide clarity and context for failed assertions.

Bad Practice

func testFoo() {
  XCTFail()
}

Recommended

func testFoo() {
  XCTFail("The test `testFoo` is failed")
}