Skip to content

cocodelabs/CCLRequestReplay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CCLRequestReplay

Build Status

CCLRequestReplay is greatly inspired by VCRURLConnection, however it supports creating a recording purely from code instead of having to actually record the requests manually and store them in a json file. It also supports using API Blueprint's directly so you can write your iOS and OS X tests directly to your API specification without writing any extra code.

Usage

Recording

CCLRequestReplayManager *manager = [[CCLRequestReplayManager alloc] init];
[manager record];

/* Make an NSURLConnection */

[manager stopRecording];

Re-playing

[manager replay];

/* Make an NSURLConnection, it will be served from the manager */

[manager stopReplay];

API Blueprint

To use CCLRequestReplay with API Blueprint, first you will need to convert your API Blueprint file from Markdown to JSON. This process can be done with Snow Crash. Once installed, the conversion can be done by invoking it with your Markdown file as follows.

$ snowcrash -o PalaverTests/Fixtures/palaver.apib.json -f json palaver-api-docs/palaver.apib

Then simple add your JSON file to your bundle so you can pull it out in your tests using the following:

NSURL *blueprintURL = [[NSBundle mainBundle] URLForResource:@"fitnessfirst.apib" withExtension:@"json"];
CCLRequestReplayManager *replayManager = [CCLRequestReplayManager managerFromBlueprintURL:blueprintURL error:nil];
[replayManager replay];

Be sure to keep the manager alive across all your tests that need it.

Installation

Installation is simple, add the following to your Podfile:

pod 'CCLRequestReplay', :git => 'https://github.com/cocodelabs/CCLRequestReplay'

License

CCLRequestReplay is released under the BSD license. See LICENSE.

About

Powerful Objective-C library to replay HTTP responses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published