So I have spent the last 3 weeks spending about 3 hours on Friday's learning what I can about unit test. Obviously I am no expert and I am still learning. The site that has helped me most is NSHipster since I need to learn Xcode based programming with Objective C. The 2 links I have been going over are Unit Testing and XCTestCase.
So with all unit test you will want to run a set up and tear down that will run before each test. This sets up the data you are using to test. You will want to also create a mock database as you are testing the code and not your integration with the database. Then for each unit test you will use the set up and implement a function of the code you are willing to test. Then you will use an assert to check that it is correct by comparing the data output with the correct answer and if it fails you will put out a specific error with the code. This helps you pin point exactly where it is failing. There are all different types of unit test so make sure you are using the correct asserts. To learn more about unit test you can go to the 2 links I provided and you can also go to Udemy and find a course on unit testing.
QA Hipster is a Quality Assurance Technical Lead for an software company, mostly working with Macs. I have been in the field since September 2013, and have a bachelor's degree in Management Information Services. I started my studies at Iowa State in Software Engineering. I have been working on moving my company forward with the latest QA techniques.