Discover and read the best of Twitter Threads about #filepath

Most recents (2)

XCTest tips and tricks that can level up your Swift testing.

🧵👇
1. Use XCTUnwrap instead of force wrapping optionals

Force unwrapping a nil will cause the test suite to completely crash, meaning no output or reporting. XCTUnwrap provides a nice failure message and fails the test.
2. Set continueAfterFailure to false

If you have multiple assertions in a test they might increase in specificity. The first asserts the size of the array and the second assets the first element. You don't want to run the second if the first fails, it's just noise.
Read 13 tweets
OK, so this change from #file to #filePath in Swift 5.3 is a pain in the arse. I now need to use conditional compiler statements in my custom test assertions (as XCT___ now takes a #filePath) to maintain backwards compatibility.
Discussion on this: forums.swift.org/t/revisiting-t… - I’m a bit confused how this proposal made it through in such a source-breaking way.
All this boilerplate just to work around this issue: github.com/lukeredpath/sw…
Read 3 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!