Skip to content

Unit and Integration Testing

Jasper Blues edited this page Jun 22, 2021 · 2 revisions

Unit Testing

Unit Testing means testing a class in isolation from it's dependencies using test-doubles such as mocks or stubs.

For unit tests: Pilgrim is not required, just provide a test double (mock or stub) in place of the concrete dependency, although you might use an application component to help test assertions, as shown next.

Integration Testing

Integration Testing means testing a class using real dependencies.

For integration tests, you can obtain a fully assembled component using the @Assembled property wrapper like so. You can also obtain a helper class (such as the application configured JSON decoder):

class RealtimePayloadMarshallerTests: XCTestCase {

    @Assembled var marshaller: RealtimePayloadMarshaller
    @Assembled var decoder: JSONDecoder

    func test_it_encodes_message() throws {
       
    }
}

Quick Start!

Get started in two minutes.

Main Track

Get familiar with Pilgrim.

Advanced Topics

Become a Pilgrim expert.

Under the Hood

For contributors or curious folks.

Clone this wiki locally