[Update] For a complete updated guide with code example, please refer to this.
I am gonna use Java and Windows to help explain that to you, you can use the equivalent of that in your preferred language/OS:
Putting all that together, you formulate a command like:
cmd /c "C:/Program Files (x86)/Appium/node.exe" "C:/Program Files (x86)/Appium/node_modules/appium/bin/Appium.js" --address 127.0.0.1 --chromedriver-port 9516 --bootstrap-port 4725 --selendroid-port 8082 --no-reset --local-timezone
To execute that command using Apache Commons Exec:
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
Executor executor = new DefaultExecutor();
executor.execute(new CommandLine("The command you just formulated above"), resultHandler);
I am not sure if it's the best approach, but it works just fine with me. @bootstraponline @jlipps Can you please confirm if this is the best approach?
Note: In case of starting more than one server instance on the same machine, you have to replace the killall command to prevent killing the server of the first instance after staring a second one. Sadly I hit a dead-end in this part (I am currently leaving the server instances opened and I close them manually after the test is done until I find a better approach to killing the server in a more smart way).
- To capture all Appium log messages in a file, add the following flag to your Appium server arguments:
Hope this helps. Just ask if anything is not clear