Unit testing v/s UI Testing
Unit testing seeks to give a rapid feedback to developers to assess the correctness of their code.
UI testing validates the application as a whole. It ensures that the final product performs as expected by users.
In Unit tests you need to have a test case class for each class in your app. Each test case should then focus on a single class and test it as thoroughly as possible. Therefore, Unit tests have access to the code (modules and classes) of the app.
UI tests do not have access to the code. However, it makes use of the accessibility features of Xcode to test for specific components.