CatchingFire alternatives and similar libraries
Based on the "Testing" category.
Alternatively, view CatchingFire alternatives based on common mentions on social networks and blogs.
-
OHHTTPStubs
Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers! -
UI Testing Cheat Sheet
How do I test this with UI Testing? -
XCTest
The XCTest Project, A Swift core library for providing unit test support -
Mockingjay
An elegant library for stubbing HTTP requests with ease in Swift -
Mocker
Mock Alamofire and URLSession requests without touching your code implementation -
Buildasaur
Automatic testing of your Pull Requests on GitHub and BitBucket using Xcode Server. Keep your team productive and safe. Get up and running in minutes. @buildasaur -
Mockingbird
A Swifty mocking framework for Swift and Objective-C. -
Erik
Erik is an headless browser based on WebKit. An headless browser allow to run functional tests, to access and manipulate webpages using javascript. -
Spectre
BDD Framework and test runner for Swift projects and playgrounds -
Mussel
A framework for easily testing Push Notifications and Routing in XCUITests -
Mockit
A simple mocking framework for Swift, inspired by the famous http://mockito.org/ -
AutoMockable
AutoMocker is a Swift framework that leverages the type system to let you easily create mocked instances of your data types. -
Guava
A Swift test double library. Guava - looks like an apple but it's not.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of CatchingFire or a related project?
README
CatchingFire
CatchingFire is a Swift test framework, which helps making expectations against the error handling of your code. It provides for this purpose two higher-order functions, which take throwing functions and check whether the given closure throws or not. It integrates seamlessly with the expecters provided by XCTest
.
Usage
AssertNoThrow
AssertNoThrow
allows you to write safe tests for the happy path of failable functions.
It helps you to avoid the try!
operator in tests.
If you want to test a function, which may fail in general, you may think of using try
.
But this would mean that you have to declare your test method as throwing, which causes that
XCTest doesn't execute the test anymore.
So in consequence, you would usually need to write:
XCTAssertEqual(try! fib(x), 21)
If the expression fails, your whole test suite doesn't execute further and aborts immediately, which is very undesirable, especially on CI, but also for your workflow when you use TDD.
Instead you can write now:
AssertNoThrow {
XCTAssertEqual(try fib(x), 21)
}
Or alternatively:
AssertNoThrow(try fib(x)).map { (y: Int) in
XCTAssertEqual(y, 21)
}
If the expression fails, your test fails.
AssertThrow
AssertThrow
allows to easily write exhaustive tests for the exception paths of failable functions.
It helps you to avoid writing the same boilerplate code over and over again for tests.
If you want to test a function, that it fails for given arguments, you would usually need to write:
do {
try fib(-1)
XCTFail("Expected to fail, but did not failed!")
} catch Error.ArgumentMayNotBeNegative {
// succeed silently
} catch error {
XCTFail("Failed with a different error than expected!")
}
Instead you can write now:
AssertThrow(Error.ArgumentMayNotBeNegative) {
try fib(-1)
}
If the expression or closure doesn't throw the expected error, your test fails.
Installation
CatchingFire is available through CocoaPods. To install it, simply add it to your test target in your Podfile:
use_frameworks!
target "AppTest" do
pod 'CatchingFire'
end
Author
Marius Rackwitz, [email protected]
Find me on Twitter as @mrackwitz.
License
Version is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the CatchingFire README section above
are relevant to that project's source code only.