
Boilerplate-free mocking framework for Swift!
Cuckoo is a powerful mocking framework for Swift that was created to fill the gap of a proper Swift mocking framework. It provides a DSL (Domain-Specific Language) that is similar to Mockito, making it easy for developers coming from Java/Android to use. The framework has two parts: the runtime and the OS X command-line tool called CuckooGenerator. Cuckoo uses a compile-time generator to generate supporting structs and classes that are used by the runtime in the test target. This allows for mocking of overridable things based on inheritance and protocol adoption.
To install Cuckoo using CocoaPods, add the following line to your test target in your Podfile:
pod 'Cuckoo'
Then, add the following Run script build phase to your test target's Build Phases above the Compile Sources phase:
${PODS_ROOT}/Cuckoo/run generate
Make sure the run script is above the Compile Sources phase to avoid any race condition errors during build. Additionally, you may need to add the path of the OUTPUT_FILE into the "Output Files" section of the build phase to avoid any regeneration issues with new changes.
To install Cuckoo using Swift Package Manager, do the following steps in Xcode:
https://github.com/MakeAWishFoundation/Cuckoo.git as the package repository URL.Cuckoo is a powerful mocking framework for Swift that fills the gap of a proper Swift mocking framework. It provides a DSL inspired by Mockito and supports inheritance, generics, simple type inference, and Objective-C mocks. The framework is easy to install using CocoaPods or Swift Package Manager, making it accessible to a wide range of Swift developers.
