An elegant Swift library for stubbing HTTP requests in tests, compatible with NSURLConnection, NSURLSession, Alamofire, and AFNetworking.
Mockingjay is a Swift library for stubbing HTTP and HTTPS requests during unit and integration tests. It allows developers to simulate network responses, errors, and status codes without making actual network calls, ensuring tests are fast, reliable, and isolated. It supports NSURLConnection, NSURLSession, and popular networking libraries like Alamofire and AFNetworking.
iOS and macOS developers writing tests in Swift who need to mock network requests for unit, integration, or UI testing. It's particularly useful for developers using XCTest or Quick.
Developers choose Mockingjay for its elegant, extensible API, seamless integration with XCTest/Quick, and compatibility with major Swift networking libraries. It simplifies test setup with built-in matchers and builders while allowing custom extensions for complex scenarios.
An elegant library for stubbing HTTP requests with ease in Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically unloads stubs after each test case, ensuring test isolation without manual cleanup, as highlighted in the README for both XCTest and Quick.
Supports dynamic URL patterns using URI templates, allowing stubbing for APIs with variable path segments like '/{user}/{repository}' without hardcoding URLs.
Enables custom matchers and builders through simple closures, making it adaptable to complex stubbing scenarios beyond the built-in functions like 'everything' or 'uri'.
Works with Alamofire, AFNetworking, and any library using NSURLConnection or NSURLSession, covering most Swift networking libraries without extra configuration.
Only supports stubbing for HTTP and HTTPS requests, making it unsuitable for testing other protocols like gRPC or WebSockets, which require separate tools.
The API is based on closures and doesn't explicitly integrate with Swift's async/await, requiring additional boilerplate for modern codebases using concurrent networking.
Installation documentation primarily recommends CocoaPods, which may be a barrier for teams exclusively using Swift Package Manager, though community support might exist.