Latest 0.0.3
Homepage https://github.com/mgchris/CocoaHTTPServerExpress
License BSD
Platforms ios 7.0, requires ARC
Dependencies CocoaHTTPServer
Authors

The goal is to be an embedded HTTP Server used for testing. The idea is for your test you create an instance of a server, give it a set of conditions to watch for and the response when a condition is met.

Here is a simple testing example:

- (void)testGetStringFromServer {

    // Create Manager
    HTTPExpressManager* server = [[HTTPExpressManager alloc] init]; // Create instead of manager (server)

    // Connect request and response to server
    NSURL* expectedURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/string.media", [server urlStringForHost]]];
    NSString* expectedString = @"This is what we expect to get back";
    [server connectURL:expectedURL withString:expectedString];

    // Test
    NSString* string = [NSString stringWithContentsOfURL:expectedURL encoding:NSUTF8StringEncoding error:nil]; // Make server call
    XCTAssertTrue([expectedString isEqualToString:string], @"Strings do not match! expected: %@  got: %@", expectedString, string);
}

CocoaPods

  1. Add CocoaHTTPServerExpress to your project’s Podfile:

    target :MyApp do
    # Your app's dependencies
    end
    
    target :MyAppTests do
      pod 'CocoaHTTPServerExpress', :git => 'https://github.com/mgchris/CocoaHTTPServerExpress.git'
    end
  2. Run pod update or pod install in your project directory.

Latest podspec

{
    "name": "CocoaHTTPServerExpress",
    "version": "0.0.3",
    "license": "BSD",
    "summary": "Embeddable HTTP server that make testing easier.",
    "homepage": "https://github.com/mgchris/CocoaHTTPServerExpress",
    "authors": {
        "Christopher Evans": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mgchris/CocoaHTTPServerExpress.git",
        "tag": "0.0.3"
    },
    "source_files": "CocoaHTTPServerExpress/HTTPExpress/**/*.{h,m}",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "dependencies": {
        "CocoaHTTPServer": []
    }
}

Pin It on Pinterest

Share This