FBSimulatorClient is a simple way to interface talk to FBSimulatorControl framework to control using Rest Web Services. FBSimulatorControl is a Mac OS X library for managing and manipulating iOS Simulators.
The FBSimulatorClient depends a opensource lib called as GCD WebServer To install a the dependencies you need CocoaPods. If you don't know whats cocoapods please refer to its getting started with CocoaPods guide. The nearest thing that i can tell you is that CocoaPods is like Maven but for XCode.
Once your build the app, you can launch it in command line with the following command:
./FBSimulatorClient.app/Contents/MacOS/FBSimulatorClient --start-server --port 9898
Following are the endpoints which can be hit
- Launch the simulator
- endpoint : /simulator/launch
- method : POST
- body :
{"simulatorType":"iPhone5s", "appPath":"/path/to/app"}
- curl :
curl -H "Content-Type: application/json" -X POST -d '{"simulatorType":"iPhone 5s","appPath":"/Users/tapan/awesome-app/Debug-iphonesimulator/awesome.app"}' localhost:9898/simulator/launch
- Kill the simulator(s)
- endpoint : /simulator/kill
- method : POST
- body :
{"processIdentifer" :"Process identifier of the sim to kill"} or nothing to kill all simulators
- curl :
url -H "Content-Type: application/json" -X PUT -d '{"processIdentifier":"6410"' localhost:9898/control
- Quit the application
- endpoint : /control
- method : PUT
- body :
{"command" : "quit"}
- curl :
curl -H "Content-Type: application/json" -X PUT -d '{"command":"quit"}' localhost:9898/control
There are obviously more things to be done. But its a start. Look at the power of this thing -
Follow me on Twitter (@tapthaker)
- Add a new issue on github.
- Add a question on stackoverflow and mention me in a tweet with the link.
- More control on the simulators.
- Introduce FBSimulatorControl as podfile instead of prebuild framework
- Integrate this with some automation frameworks like Calabash for parallel execution of features
- Stability issues