Swift Mocking Library
Mimus is a bird genus in the family Mimidae. It contains the typical mockingbirds.
Mimus is a Swift mocking library, aiming to reduce boilerplate code required for building mocks in Swift. It’s been battle tested at AirHelp and Toptal where it’s being used extensively across test suites.
A Mimus mock can be created by declaring a class that conforms to your custom protocol and Mimus Mock
type:
class FakeAuthenticationManager: AuthenticationManager, Mock {
var storage = Mimus.Storage()
func beginAuthentication(with email: String, password: String) {
recordCall(withIdentifier: "BeginAuthentication", arguments: [email, password])
}
}
Afterwards you can verify whether specific call was received:
let fakeLoginAuthenticationManager = FakeAuthenticationManager()
(...)
fakeLoginAuthenticationManager.verifyCall(withIdentifier: "BeginAuthentication",
arguments: [mEqual("Fixture Email"), mEqual("Fixture Password")])
You can find more on the basic usage here.
For detailed usage refer to documentation folder.
Mimus is available through CocoaPods. To install
it, simply add the following line to your Podfile against your test target:
pod "Mimus"
You can also use Carthage for installing Mimus.
Simply add it to your Cartfile:
github "mimus-swift/Mimus"
and then link it with your test target.
Mimus is available through Swift Package Manager.
dependencies: [
.package(
url: "https://github.com/mimus-swift/Mimus.git",
from: "1.1.4"
)
]
To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter its repository URL.
You can also navigate to your target’s General pane, and in the “Frameworks, Libraries, and Embedded Content” section, click the + button.
In the “Choose frameworks and libraries to add” dialog, select Add Other, and choose Add Package Dependency.
Mimus is an AirHelp open source project, designed and implemented by
Logo Design by Arkadiusz Lipiarz @arek_lipiarz, [email protected]
Mimus is available under the MIT license. See the LICENSE file for more info.