Bundles
To run your tests, you'll need to compile them into an
NSBundle.
The bundle form was chosen because it is a grouping of code and resources. Many non trivial tests involve
not only the code being tested, but external files.
There are a couple ways to create a test bundle. TestKit installs a test bundle template that
will run the test bundle as the last step of the build process. Failed tests will show up in the build
progress window, and cause the build to fail. To create a test bundle from the template:
- Select
Project->New Target...
- Choose
TestKit->Test Bundle
- Click
Next
- Select a name for your test bundle
- Click
Finish
-
Verify that your test bundle includes the TestKit framework. If not, add it. You may need to add
the TestKit framework to your project
- Add you test cases to the test bundle
- Add any resources your tests depend on to the bundle
Principal Class
By default, the testing tools provided with TestKit will run every test case
found in a test bundle. To gain more control over which tests are run, you may specify a Principal Class
for your test bundle. If TestRunner determines that a specific Principal Class has been indicated in
your test bundle, then only that class will be considered for executing tests. If that class, in turn,
implements the +suite method, then only the test/suite returned from that method will be run.
See NSBundle's
documentation for more information on bundles.
|