Essential Developer

View Original

iOS Testing Challenges: StoreKit, Firebase, UIKit, UserDefaults | iOS Lead Essentials Podcast #024

Watch on YouTube | Podcast

If you've been following us for a while, you know we recommend you test your code.

In fact, we highly recommend you practice Test-Driven Development and write the tests first.

And if you've been taking our advice, you probably faced a bunch of code that's hard to test.

Maybe because you're dealing with legacy code that was built with no testability in mind.

Or you're dealing with some 3rd-party frameworks or infrastructure that's unreliable, like databases and backend APIs.

You may also feel stuck wondering if you've tested your code enough or even if you've tested your code too much.

In this podcast, we present practical solutions to 12 common challenges you'll face when writing a test suite for your iOS/Swift apps. Including:

- "How to test random values without mocking the random algorithm?"

- "How to test code that asynchronously dispatches work to the main DispatchQueue?"

- "How can I test code that depends on the current Date and Time?"

- "How to test if a UITextField is focused? I can't check that it becomes the first responder in unit tests - isFirstResponder always returns false"

- "How to test parts of the app that uses Firebase?"

- "How to test StoreKit?"

- "How to test Sign in with Apple?"

- "How to test a UIImageView of a UITableViewCell that fetches an image from a URL using SDWebImage?"

- "I have an AlertControl class to present alerts in my app. How to test that the AlertControl shared instance displays the alert on certain UI events?"

- "How to test that a component is storing values in UserDefaults correctly?"

We highly recommend you watch or listen to this podcast. You'll learn fast and reliable ways to validate code that's hard to test and deliver better apps with confidence.

Subscribe now to our Youtube channel and Podcast to catch new episodes.

Notes