expecta

Expecta is a delightful micro framework for writing test assertions in Objective-C.

Installation

To install Expecta using CocoaPods, add the following line to your Podfile:

pod 'Expecta'

Then, run the command below:

pod install

Usage

Using Expecta is straightforward. Simply import Expecta in your test file:

#import <Expecta/Expecta.h>

Then, begin writing your assertions. Expecta uses a BDD (Behavior-Driven Development) style syntax to make tests more readable:

expect(someValue).to.equal(expectedValue);

Here are some of the most commonly used Expecta matchers:

  • equal
  • beGreaterThan
  • beLessThan
  • beGreaterThanOrEqualTo
  • beLessThanOrEqualTo
  • beCloseTo
  • beTruthy
  • beFalsy
  • contain
  • beIdenticalTo
  • beginWith
  • endWith
  • beInstanceOf

Running Tests

To run your tests, simply select your test target and hit the Test button in Xcode. Alternatively, you can also run tests from the command line by using the following command:

xcodebuild test -workspace YourWorkspace.xcworkspace -scheme YourScheme

Contributing

If you would like to contribute to Expecta, please check out the GitHub repository and submit a pull request. We appreciate and welcome contributions!