Questions tagged [nocilla]

An HTTP stubbing library for Cocoa/Cocoa Touch.

Nocilla is a library which can be used for testing applications by issuing HTTP requests. Supports HTTP and HTTPS schemes and can generate error responses. Response verification is regex-based.

11 questions
3
votes
1 answer

How to test AFNetworking

*Edit - I originally wanted to test AFNetworking using Nocilla but ended up using OHHTTPStubs to do the job. I've answered the original question below, using OHHTTPStubs * Original Question: I want to test the APIClient of our app - the bare bones…
Octave1
  • 525
  • 4
  • 19
2
votes
1 answer

Stubbing HTTP Requests in Swift

I am using Swift for an iOS app, and using Alamofire to perform HTTP requests. I want to write unit tests to cover my functions, but I'm having trouble stubbing the HTTP requests performed by Alamofire. I am using Nocilla (imported into bridging…
vlin
  • 825
  • 1
  • 6
  • 13
2
votes
1 answer

iOS Kiwi/Nocilla Tests not calling blocks

I am trying to get familar with the Kiwi BDD testing framework. I am using it it in conjuction with Nocilla to mock HTTP requests. Both projects look awesome but I am having some difficulty with it. I have the following test spec: beforeAll(^{…
Nick
  • 19,198
  • 51
  • 185
  • 312
2
votes
1 answer

Xcode 4 - Header file not found when including 3rd party static lib

I am trying to check out Nocilla but I can't seem to get my test target to build when I include it. I cloned the Nocilla repo and built the static lib (targeting simulator) from source. I am linking the nocilla static lib to my test target. I have…
Nick
  • 19,198
  • 51
  • 185
  • 312
1
vote
0 answers

Can I stub different responses for subsequent calls to the same endpoint with Nocilla?

I want to do something like this: stubRequest("GET", "http://localhost:8000/api/foo").andReturn(401) stubRequest("GET", "http://localhost:8000/api/foo").andReturn(200) let result = service.myServiceCall() XCTAssertEqual(result, "My Result") ...…
Robert Atkins
  • 23,528
  • 15
  • 68
  • 97
1
vote
0 answers

iOS Nocilla expect a request to have a header

I'm using Nocilla along with Kiwi and I need a test that verifies that the my network client correctly sets given a HTTP header to the request under certain circumstances. How can I do that? cheers, Jan
Jan
  • 7,444
  • 9
  • 50
  • 74
1
vote
2 answers

Are OCMock and Nocilla incompatible?

I am trying to use both OCMock and Nocilla in the same set of unit tests. I used CocoaPods to install them both, and reference them using #import #import But when I try to use Nocilla's .andReturn in the…
Ravi Desai
  • 461
  • 4
  • 12
1
vote
1 answer

Application running when executing iOS tests interfere Nocilla Stubs

I'm using Nocilla to stub HTTP requests and it is working ok. I can stub the requests, return json fixtures and assert over it. The problem is that the application runs when the test starts and some requests are made on the viewDidLoad of the first…
Raphael Oliveira
  • 7,751
  • 5
  • 47
  • 55
0
votes
0 answers

Tests get blocked when testing asynchronous network stuff with Nocilla

I'm trying to test a class that has a method responding asynchronously that makes a network call, stubbed by Nocilla. The tests runs fine when I run the test alone. But as soon as I launch my whole test suite, it blocks here for a while and finishes…
Mick F
  • 7,312
  • 6
  • 51
  • 98
0
votes
1 answer

iOS Kiwi + Nocilla - Failing to stub request

I'm just starting out with stubbing requests to test async calls to an external API with iOS. I'm currently stuck with the following code and I can't figure out what's not working. The very simple thing I'm trying to achieve is that if I get a 200…
Mike
  • 63
  • 1
  • 7
0
votes
1 answer

Testing HTTP using Kiwi/Nocilla

I just started developing an app that connects to this URL and retrieves the rate exchange for a given pair of currencies. I need to test the HTTP request and I ended up learning about Kiwi and Nocilla. However, I'm completely new to any kind of…
Diego A. Rincon
  • 747
  • 1
  • 8
  • 25