Faking a Network-Service API

As it is right now, our app derives its usefulness from OpenStreetMap, a relatively simple black box. We hand it a rectangle of geographical coordinates and a search string, and it returns a JSON array of dictionaries that we parse. There’s neither authentication nor any other hoops to jump through to get the information. That makes this an ideal candidate to practice building a fake service.

We’re going to build a simple web server to return consistent JSON results given a box around a geographical point. We can make the data whatever we want, and it will never change unless we change it. We’ll then learn how to point the app at our fake server when running in the test environment. Our tests will no longer depend ...

Get Test iOS Apps with UI Automation now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.