Latest 0.0.3
License MIT
Platforms ios 8.0

CI Status



To run the example project, clone the repo, and run pod install from the Example directory first.


  • Compatible with iOS.
  • Support for Acceptance Tests.
  • Support for custom validators.
  • Support for custom filters.
  • It doesn’t support concurrency.

Features backlog

  • Implement new filters for requests based on headers, parameters, ….



Szimpla is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Szimpla"

How to use it

Adding a reference to the snapshots folder

Szimpla saves the snapshots in a folder that you specify using an environment variable, SZ_REFERENCE_DIR. Open your project scheme, and in the Run section, add the variable to the Environment Variables section. The value should be the folder where you would like your network snapshots to be saved.

Name Value

Adding the server to the App

In order to record the sent requests it’s very important to start the server when your app is built for UI tests:

Add the tearUp() method to the AppDelegate as shown below:

import Szimpla
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  if isUIBuild {
    try! Szimpla.Server.instance.tearUp()
  return true

And in your requests make sure you use the configuration provided by the Szimpla server:

var configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
if isUIBuild {
  configuration = Szimpla.Server.instance.sessionConfiguration(fromConfiguration: configuration)

Recording requests

The first step when testing Network requests is recording the requests in a .json file. This file will be used for validating future tests executions. Using Szimpla to get these requests saved is very simple:

import Szimpla

// Navigate to the point where you would like to start testing.
try! Szimpla.Client.instance.start() // Starts recording
// Do all your UI tests steps
try! Szimpla.Client.instance.record(path: "share/player.json") // Saves the recorded requests

Requests will be saved under ${SZ_REFERENCE_DIR}/share/player.json

Adapting requests

Szimpla validates:

  • If the the same number of requests are sent
  • If each request matches the definition in the json file. That is, the fields are present and match the value.

Since most of the time values might be relative, Szimpla support using regular expressions for your .json fields. Once you have your .json file with the requests recorded:

  1. Remove these fields you are not interested in checking.
  2. Update the ones that are dynamic a regular expression instead.

Validating requests

The validation process is similar to the recording one. The only difference in this case is the method used to complete:

import Szimpla

// Navigate to the point where you would like to start testing.
try! Szimpla.Client.instance.start() // Starts recording
// Do all your UI tests steps
Szimpla.Client.instance.validate(path: "share/player.json") // Validates the recorded requests

It the validation fails, it’ll assert using XCTAssert printing the validation error. :tada:


Since you might not be interested in all the requests you can decide which ones using filters. Filters conform the protocol RequestFilter and it’s public, thus, you can create your own filters. When requests are recorded or matched you can provide a filter to be used instead of recording all the requests.

Szimpla also provides some default filters that you can use:

  • URLRequestFilter: Filters all these URLs that match the base URL.


  • ios-snapshot-testing: Link
  • UI Testing in Xcode: Link


Pedro Piñera Buendía, [email protected]


Szimpla is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "Szimpla",
    "version": "0.0.3",
    "summary": "Networking Testing library for Swift",
    "description": "Networking testing library that records requests and match them later with future tests executions.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Pedro Pinu0303era Buendiu0301a": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.0.3"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "subspecs": [
            "name": "Core",
            "source_files": "Szimpla/Classes/Core/**/*"
            "name": "Server",
            "source_files": "Szimpla/Classes/Server/**/*",
            "dependencies": {
                "NSURL+QueryDictionary": [],
                "SwiftyJSON": [],
                "Swifter": [],
                "Szimpla/Core": []
            "name": "Client",
            "source_files": "Szimpla/Classes/Client/**/*",
            "frameworks": "XCTest",
            "dependencies": {
                "SwiftyJSON": [],
                "Szimpla/Core": []

Pin It on Pinterest

Share This