Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8086765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:33:10+00:00 2026-06-05T18:33:10+00:00

I’m working on an iOS app whose primary purpose is communication with a set

  • 0

I’m working on an iOS app whose primary purpose is communication with a set of remote webservices. For integration testing, I’d like to be able to run my app against some sort of fake webservices that have a predictable result.

So far I’ve seen two suggestions:

  1. Create a webserver that serves static results to the client (for example here).
  2. Implement different webservice communication code, that based on a compile time flag would call either webservices or code that would load responses from a local file (example and another one).

I’m curious what the community thinks about each of this approaches and whether there are any tools out there to support this workflow.

Update: Let me provide a specific example then. I have a login form that takes a username and password. I would like to check two conditions:

  1. wronguser@blahblah.com getting login denied and
  2. rightuser@blahblah.com logging in successfully.

So I need some code to check the username parameter and throw an appropriate response at me. Hopefully that’s all the logic that I need in the “fake webservice”. How do I manage this cleanly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:33:11+00:00Added an answer on June 5, 2026 at 6:33 pm

    As far as option 1, I have done this in the past using CocoaHTTPServer and embedding the server directly in an OCUnit test:

    https://github.com/robbiehanson/CocoaHTTPServer

    I put up the code for using this in a unit test here:
    https://github.com/quellish/UnitTestHTTPServer

    After all, HTTP is by design just request/response.

    Mocking a web service, wether by creating a mock HTTP server or creating a mock web service in code, is going to be about the same amount of work. If you have X code paths to test, you have at least X code paths to handle in your mock.

    For option 2, to mock the web service you would not be communicating with the web service, you would be instead be using the mock object which has known responses.
    [MyCoolWebService performLogin:username withPassword:password]

    would become, in your test

    [MyMockWebService performLogin:username withPassword:password]
    The key point being that MyCoolWebService and MyMockWebService implement the same contract (in objective-c, this would be a Protocol). OCMock has plenty of documentation to get you started.

    For an integration test though, you should be testing against the real web service, such as a QA/staging environment. What you are actually describing sounds more like functional testing than integration testing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.