Do I need special libraries for this, or can I just create a huge class that trys to instantiate every object of my project and test all the methods in there? How's that done in theory?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- Dependencies while implementing Mocking in Junit4
- how do you prevent page scroll in textarea on mobi
相关文章
- How to replace file-access references for a module
- How to mock methods return object with deleted cop
- What is a good way of cleaning up after a unit tes
-
EF6 DbSet
returns null in Moq - Could I create “Call” button in HTML 5 IPhone appl
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- React testing library: Test attribute / prop
GHUnit is awesome.
If you're targeting iPhone OS 2.2 or later, you can use the version of OCUnit that's bundled with Xcode. There's a good blog article by Kailoa Kadano about this on Mobile Orchard. OCUnit is a unit testing framework that's similar to the well known JUnit framework from the Java world.
You can always do "poor man's unit testing" by creating a simple test program that uses the
assert()
macro in the C headerassert.h
or theNSAssert()
macros in Cocoa/Cocoa-touch. That's not a horrible way to get started doing unit testing, but I'd really recommend looking at OCUnit or another unit testing framework eventually.Which ever way you structure your unit tests, you'll want to create a separate target in your Xcode project to build and run the tests.
Googling "unit testing iPhone" gives this excellent link as the first hit:
To sum up, Google Toolbox provides a good infrastructure for unit testing on iPhone.
I really love Kiwi: BDD (RSpec) for iPhone & iPad.
For a comprehensive answer, check out iOS Tests/Specs TDD/BDD and Integration & Acceptance Testing.