Skip to content
No description, website, or topics provided.
Swift Objective-C Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
FrenchKit 2017 Paw Workshop.pdf
FrenchKit Paw Classroom.paw

From API Description to Tests & Mocks

Download Slides


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.


  • Your Mac
  • Xcode 8 or 9
  • A bit of Swift…
  • Paw (get the 30 days trial)

Today’s Agenda

A – XKCD client app

  1. Build a client app for the XKCD website (using their API)
  2. Mock the API to make the tests pass independently from the API

B – Instagram API with the help of Paw

  1. Introducing the Instagram API
  2. Import the Instagram API in Paw File > Import > Find API Template
  3. Download ready-to-go Paw file
  4. Generate Alamofire code snippets with Paw
  5. Build & run
  6. Create a new Instagram client app – load your own Instagram feed

C – Integrate with Tests

Use the Instagram app for that, set up tests for each feature, and people can implement the stubs.

  1. Build a unit test case for Instagram.loadImages(tag:, count:)
  2. Use Paw to generate mocks from an existing response. Install Mockingjay Code Generator
  3. Write mocks to test the API

D – JSON Schema Validation

  1. Example of what JSON Schema is and used for
  2. Add validation to your app to assert the server results
You can’t perform that action at this time.