This Xcode workspace demonstrates how to use JustEat's Shock library to mock out the server for faster, more reliable UI tests.
The workspace contains an application target (ShockExperiment) and a UI testing target (ShockExperimentUITests). The application is super simple such that all it does it fire a network request on load to fetch a list of Star Wars characters and then updates a label to say how many characters were fetched (if successful) or that something went wrong (if unsuccessful). The UI testing target contains a number of tests which each:
- Mock the server to return a particular response;
- Launch the application; and then
- Assert that the application displays the expected text based on the server response.
- Clone this repository.
- Open the ShockExperiment.xcworkspace file in Xcode.
- Build the project.
- Run the tests.
This workspace assumes that you have a GitHub source control account added to your Xcode preferences. Xcode uses your GitHub account to fetch this workspace's Swift package dependencies.