[Pitch] Prettify XCTAssertEqual

As developer, Unit Test is part of our daily life. With it, we can assure the stability of our code.
XCTest is framework to write unit tests on swift, and i believe XCTAssertEqual is one if not the most used assert.

but current output for the assertion is like this

Several issue with current output

  • it's hard to find which property or variable that cause the error
  • if the object that being assert have huge property, much harder to check

inspired by swift-composable-architecture#Diff.swift diff function (used for creating better output for state changes), we can create better XCTAssertEqual output to highlight the issue.

Screen Shot 2021-06-11 at 09.48.04

Let me know what do you think about this idea


I would really love this to be native to XCTest


This would be great, as would many other changes and improvements to XCTest and testing in Swift generally. However, XCTest, like Foundation, is not subject to the Swift Evolution process, given its closed-source nature on Apple platforms, so it's unlikely we can do much to help here.

what would you suggest, should we open feedbacks instead?

isnt XCTest an open source project here GitHub - apple/swift-corelibs-xctest: The XCTest Project, A Swift core library for providing unit test support ?


That, like swift-corelibs-foundation, is an open, Swift-native port of the framework for non-Apple platforms. Since the APIs of the framework must maintain parity with the Apple version, we can't add APIs or other behavior changes in the open version by itself. Apple drives the evolution of these APIs.

1 Like
Terms of Service

Privacy Policy

Cookie Policy