Skip to content
프로젝트

소개

VCRURLConnection is an iOS and OSX API to record and replay HTTP interactions, inspired by VCR for ruby

웹 및 앱 개발

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Build Status

VCRURLConnection

VCRURLConnection is an iOS and OSX API to record and replay HTTP interactions, inspired by VCR

VCRURLConnection is still in the very early stages of development, all bug reports, feature requests, and general feedback are greatly appreciated!

Recording

[VCR start];
 
NSString *path = @"http://example.com/example";
NSURL *url = [NSURL URLWithString:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

// use either NSURLSession or NSURLConnection
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request];
[task resume];
 
// NSURLSession makes a real network request and VCRURLConnection
// will record the request/response pair.

// once async request is complete or application is ready to exit:
[VCR save:@"/path/to/cassette.json"]; // copy the output file into your project

Replaying

NSURL *cassetteURL = [NSURL fileURLWithPath:@"/path/to/cassette.json"];
[VCR loadCassetteWithContentsOfURL:cassetteURL];
[VCR start];

// request an HTTP interaction that was recorded to cassette.json
NSString *path = @"http://example.com/example";
NSURL *url = [NSURL URLWithString:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

// use either NSURLSession or NSURLConnection
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request];
[task resume];
 
// The cassette has a recording for this request, so no network request
// is made. Instead NSURLConnectionDelegate methods are called with the
// previously recorded response.

Installation

Carthage

Add the following to your Cartfile:

github "dstnbrkr/VCRURLConnection"

Then run $ carthage update.

Follow the current instructions in Carthage's README for up to date installation instructions.

Manual

  • Download VCRURLConnection and try out the included example app
  • Include the files in the VCRURLConnection folder in your test target

Getting Started

  • Run your tests once to record all HTTP interactions
  • Copy the recorded json file (the file whose path is returned by [VCR save]) into your project
  • Subsequent test runs will use the recorded HTTP interactions instead of the network
  • All recordings are stored in a single JSON file, which you can edit by hand

License

VCRURLConnection is released under the MIT license

Contact

Dustin Barker

[email protected]

VCRURLConnection uses the following open source components:

관련 프로젝트 살펴보기

불러오는 중…