The reporter defines how output is logged to the console.
Observe defines a Reportable protocol that you can implement in order to customize how test output is logged. By default, Observe uses it’s own very simple reporter. There is also a Clean Reporter which we recommend you use.
Custom Reporter
If you want to build your own reporter, simply create a new type and have it conform to the Reportable protocol. Then tell Observe to use your custom Reporter.
It can be useful to have your reporter be a singleton so that you can share state across multiple tests. This will allow you to keep track of stats like how many tests were executed.
Features
BDD style
Describe application behaviour rather than verifying code.
No Dependencies
Observe is not coupled to XCTest at all, in fact Observe will never rely on any frameworks other than Foundation.
This means you never have to worry about importing any other frameworks into your code. It also means that you can use this framework in your application’s tests or your application’s core code.
Contributing
All developers should feel welcome and encouraged to contribute to Observe, see our CONTRIBUTING document here to get involved.
Observe
Observe is a BDD / TDD test framework for Swift 4 that pairs very nicely with the Focus assertion framework.
Observe and Focus are not coupled to any other frameworks so you can include this package in your tests or your main app code.
Requirements
How To Use
Installing
Open your
Package.Swift
file and add the following dependency:Run
swift build
in terminal to fetch this new dependency.Running Tests With XCTest
import Observe
Functions
Reporter
The reporter defines how output is logged to the console.
Observe defines a
Reportable
protocol that you can implement in order to customize how test output is logged. By default, Observe uses it’s own very simple reporter. There is also a Clean Reporter which we recommend you use.Custom Reporter
If you want to build your own reporter, simply create a new type and have it conform to the
Reportable
protocol. Then tell Observe to use your custom Reporter.It can be useful to have your reporter be a singleton so that you can share state across multiple tests. This will allow you to keep track of stats like how many tests were executed.
Features
BDD style
Describe application behaviour rather than verifying code.
No Dependencies
Observe is not coupled to XCTest at all, in fact Observe will never rely on any frameworks other than
Foundation
.This means you never have to worry about importing any other frameworks into your code. It also means that you can use this framework in your application’s tests or your application’s core code.
Contributing
All developers should feel welcome and encouraged to contribute to Observe, see our CONTRIBUTING document here to get involved.