Testing your Objective C library

ferrous26 edited this page Apr 11, 2012 · 4 revisions

You can easily test your Objective-C classes (first consult "Loading Objective C Frameworks and Bundles") with MacBacon, RSpec, minitest, or another test framework.

Here is an example using MacBacon.

First, install MacBacon.

$ sudo macgem install mac_bacon

Second, write a test case.

# test_spec.rb
require 'OSInfo' # Loads your library

describe 'OSInfo.version' do
  it 'should return an Integer' do

Third, run the test.

$ macbacon test_spec.rb 
  - should return an Integer

1 specifications (1 requirements), 0 failures, 0 errors

If you'd like to test UI, AXElements might help you.