Liam Ferris Liam Ferris - 4 months ago 29
iOS Question

Parallel Testing on iOS Devices

When attempting to test on multiple iOS device in parallel there are two issues that arise:


  1. Instruments, the Mac developer tool will only run a single instance. Meaning only a single test can be ran at once.

  2. iOS-Webkit-Debug-Proxy, is hard coded to run on a single port (27753) as it assumes there is only one instance of instruments


Answer

Before I start, from my investigations, I was only able to achieve parallel iOS testing using the git source for appium. When working from the npm install it did not work.


  1. To run multiple instances of instruments, you must set up temp directories when creating your iOS appium node.

To do this use these arguments:

--tmp /tmp/ios/, --tmp /tmp/ios6/ etc.


  1. iOS-Webkit-Debug-Proxy can be ran on different ports by setting the REMOTE_DEBUGGER_PORT variable in the terminal.

REMOTE_DEBUGGER_PORT=27754

You will also need to use the --webkit-debug-proxy-port argument for the appium node.

--webkit-debug-proxy-port 27754


I wrote a script to start the hub, two android nodes, two iOS nodes and put in a few procedures to log errors.

pkill elenium
pkill java
pkill ios_webkit_debug_proxy
pkill node

java -jar ../libs/selenium-server-standalone-2.46.0.jar -role hub -port 4444 > logs/log_hub.txt 2>&1 &
if [ $? = 1 ]; then
    echo hub
    exit 1
fi

appium --nodeconfig /Path/to/androidOne.json -p 4823 -bp 5724 --chromedriver-port 9515 > logs/log_androidOne.txt &
if [ $? = 1 ]; then
    echo node 1
    exit 1
fi
appium --nodeconfig /Path/to/androidTwo.json -p 4723 -bp 5723 --chromedriver-port 9516 > logs/log_androidTwo.txt &
if [ $? = 1 ]; then
    echo node 2
    exit 1
fi

node appium --session-override --nodeconfig /Path/to/iPod.json --tmp /tmp/ios/ -p 4623 --webkit-debug-proxy-port 27753 --safari > logs/log_iPodTouch.txt &
if [ $? = 1 ]; then
echo node3
exit 1
fi

node appium --session-override --nodeconfig /Path/to/iPad.json --tmp /tmp/ios6/ -p 4523 --webkit-debug-proxy-port 27754 --safari > logs/log_iPad.txt &
if [ $? = 1 ]; then
echo node4
exit 1
fi

sleep 5
REMOTE_DEBUGGER_PORT=27753
./ios-webkit-debug-proxy-launcher.js -c UDID:27753 -d > logs/log_iwdpl.txt &
if [ $? = 1 ]; then
    echo iwdpl
    exit 1
fi
REMOTE_DEBUGGER_PORT=27754
./ios-webkit-debug-proxy-launcher.js -c UDID:27754 -d > logs/log_iwdpl2.txt &
if [ $? = 1 ]; then
echo iwdpl2
exit 1
fi

The script starts by killing any processes that exist beforehand, be careful of killing all java processes if you are running other java things.

Hope this helps, Liam

Comments