I am writing my first bigger iOS project and I want to use as much of Xcode 5 as possible. Now I want to use testing but I have never done it before.
My project uses come Views
and dynamic `TableViews. How could I implement the test in the code, so that it makes sense?
Unit tests are awesome. They not only improve the overall quality of your code, they also make it easier for you to test individual pieces of your app without having to manually run your app. Given Apple's extensive support for unit tests in Xcode and Swift, it's surprising that so few iOS developers write unit tests.
The main objective of unit testing is to isolate written code to test and determine if it works as intended. Unit testing is an important step in the development process, because if done correctly, it can help detect early flaws in code which may be more difficult to find in later testing stages.
by simple example. To test an app, one needs to write three different kinds of test code. Unit Test — Test the single function without any external dependency. e.g. to test the given email is valid or not. Integration Test — Test the single function with dependency.
Please start by watching WWDC '13 session 409 - Testing in Xcode 5. It's a very good starting point.
Next, if you're not feeling confident of your approach to unit testing, I'd recommend reading "Test-Driven iOS Development" by Graham Lee.
For now, remember that a unit test tests single "unit" of functionality and does not cover performance, UI interaction and whole system integration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With