How to Test your iOS App at Multiple Levels

By Rajiv Ramnath

While you’re testing your iOS app, be sure to test it at multiple levels. Test each class and its methods. Test how the classes work together. Finally, test the final, completely put-together app from its user interface. Here’s a broader description of these levels of testing:

  • Unit testing: Testing at the level of an individual class or of a small set of related classes is known as unit testing. Individual developers typically do this kind of testing — for example, before checking it into source control for others to use in their programs.

    In unit testing, you create an instance of a class and call all its methods with different input values and then check whether the methods work properly.

    Generally, unit testing in iOS is done on a model object (such as an object of the Game class in the Tic-Tac-Toe app). However, even testing a single screen to see whether all the UI elements work properly can be thought of as unit testing.

  • Integration testing: As the name indicates, the purpose of integration testing is to ensure that the different software modules work together properly.

  • System testing: In this case, the system as a whole is tested by people acting as potential users of the app.

If you’re the only one developing an app and are wondering how the preceding levels relate to you, the answer is that you get to play all the roles. For example, you may be a single developer unit testing your components, an integration tester pulling together two components developed independently (for example, the Game class and the Game Session view controller), and a system tester testing the complete app.

You must try to find and fix as many bugs as you can. To catch as many as possible, test as many paths through your code as possible.