Closed Bug 1123430 Opened 9 years ago Closed 9 years ago

Allow tests to spin up a web server

Categories

(Firefox for iOS :: Build & Test, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: st3fan, Unassigned)

Details

Attachments

(1 file)

To support unit tests that make HTTP calls, we need to include a local web server. This server needs to be scriptable in some form so that we can generate dynamic responses and scenarios like timeouts and specific status codes.

I have tried two things without a lot of success:

First I tried to simply system("myserver.sh") as part of a unit test. This does not seem to work anymore, even in the simulator (which is an OS X app). Adding a sstem() call makes the test terminate with an 'dyld: program was built for Mac OS X and cannot be run in simulator' error. This used to be work but it is entirely possible that this was changed with recent SDKs.

Then i tried to compile Python against the iOS SDK (simulator only to keep things 'simple') but this is a daunting task and resulted in a long fight with build tools, compiler settings and what not.

I think what we need to do is use a Cocoa HTTP Server. We need one anyway to support resource loading in our app. So ideally we pick one that has programmable handlers so that we can use it for our unit tests too.

Compiling Python to a Python.framework still has my preference but I don't think we have the time at this point to invest in that.
Looks like https://github.com/swisspol/GCDWebServer is a pretty good candidate.
QA Contact: sarentz
Attached file Pull Request
Attachment #8551450 - Flags: review?(nalexander)
Comment on attachment 8551450 [details] [review]
Pull Request

With comment on PR, which I'd prefer to be addressed but isn't essential.
Attachment #8551450 - Flags: review?(nalexander) → review+
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: