Introducing how to create HTTP stubs for your application and/or unit or UI tests. We're using the Mockingjay library in Swift to create these mocks.
- Level: beginner
- Workshop at FrenchKit 2017 conference.
- Your Mac
- Xcode 8 or 9
- A bit of Swift…
- Paw (get the 30 days trial)
- Intro & Presentation
- A simple XKCD client app with Alamofire
- Build mocks with Mockingjay
- A simple Instagram client app
- Create unit + UI tests with mocks
- Build a client app for the XKCD website (using their API)
- Mock the API to make the tests pass independently from the API
- Import the Instagram API in Paw File > Import > Find API Template
- Create a new Instagram client app
- Generate Alamofire code snippets with Paw
Use the Instagram app for that, set up tests for each feature, and people can implement the stubs.
- Use Paw to generate mocks from an existing response. Install Mockingjay Code Generator
- Write basic unit tests, write mocks to test the API
- Reuse the existing UI tests, write API mocks to test the API
- Add reliable validation of UI components
- Switch code and tests to use
JSONDecoder
(Swift 4 only)
- Example of what JSON Schema is and used for
- Add validation to your app to assert the server results