2

Im new at writing iOS apps, and have nearly finished writing my first game. Ive read online about unit testing and understand that I really should have been coding with this in mind from the beginning (uh oh...).

My app is about 4000 lines of code, and includes 8 classes and about 50 methods.

Should I be concerned about unit testing? What is it exactly? and Do I have to do it before I submit to the App Store??

any answers or links to helpful resources would be greatly appreciated. Thanks!

bkbeachlabs
  • 2,121
  • 1
  • 22
  • 33
  • possible duplicate of [What is the best approach for writing unit tests for iPhone / iPad?](http://stackoverflow.com/questions/2642869/what-is-the-best-approach-for-writing-unit-tests-for-iphone-ipad) – Brad Larson Dec 24 '11 at 19:50
  • See also [How does unit testing on the iPhone work?](http://stackoverflow.com/questions/862244/how-does-unit-testing-on-the-iphone-work), [What is the best approach for writing unit tests for iPhone / iPad?](http://stackoverflow.com/questions/2642869/what-is-the-best-approach-for-writing-unit-tests-for-iphone-ipad), [iPhone Unit Testing](http://stackoverflow.com/questions/2973167/iphone-unit-testing), and [How to get started with unit testing in Xcode 4?](http://stackoverflow.com/questions/5389346/how-to-get-started-with-unit-testing-in-xcode-4) – Brad Larson Dec 24 '11 at 19:52

1 Answers1

3

There are lots of different philosophies on unit testing. Unit testing is more of use during development, so that if you want to make changes you can make them without worrying as much your change will break something you do are not thinking is related. Basically it would be writing other methods that call your internal game methods with different parameters and check to see if the results are as expected.

You do not need to unit test for the app store - chances are you have been testing the game all along as you have developed, and that user testing is a lot more important for getting something released (as it means it probably will not crash) and also of course that makes for a better game!

One final note, if you are thinking about unit testing in the future there is a downside. It can also mean more work when re-writing code as you not only have to change your original code, but also related tests and make sure the results they are looking for make sense. For a single person that overhead may not make sense; it is more helpful when many people will be changing the same code.

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150