Home / unit testing iOS interview questions

Testing

Unit testing iOS interview questions

Unit testing questions reveal whether you design code to be testable in the first place. The answers are as much about architecture as about assertions.

What actually gets tested

Expect what belongs in a unit test versus an integration or UI test, how to isolate a unit by injecting dependencies behind protocols, and how to fake network, persistence, and time so tests are fast and deterministic. Interviewers may ask you to make an untestable class testable, which usually means extracting a dependency you can substitute.

Writing good tests

Explain testing behavior and public outcomes rather than implementation details, keeping tests fast, independent, and deterministic with no real network or sleeps. Cover the meaningful cases, especially edge and error paths, without chasing coverage for its own sake. Framing testability as a design property you build in signals senior experience.

Go deeper than a summary

Share Your Screen works topics like this through in full: 75 solved Swift problems with tests, 9 real case studies, and 7 annotated mock interviews, so you rehearse the live round instead of just reading about it.

Get the book

Frequently asked

What should you unit test?

Behavior and public outcomes of your logic, especially edge and error cases, using injected fakes so tests stay fast and deterministic.

How do you make a class testable?

Inject its dependencies behind protocols so tests can substitute fakes, rather than having the class construct network, disk, or time dependencies itself.