Apple with Xcode 7 introduces UI Testing as new features of the existing XCTest framework.

The UI Testing advantages are:
– Easy UI recording
– Performance Test
– Code Coverage


With UI Testing it is possible to run tests on physical devices and simulators.
Instead of running the tests in series to n devices connected to the MAC through this script you will be able to run the tests in parallel on n device attached (in the example we perform the tests in parallel on four devices at a time).
We must create in this specific case four job for the execution of tests on the devices.

Jenkins job “Smartphone Test Farm iOS”


set -e

job_name="iOS UI Testing Tests - App Example"

function log {
echo "[$(date)] $1"

#Read attached devices
devices=$(instruments -s devices | grep -v Simulator | cut -f2 -d\[ | cut -f1 -d\] | grep -v - | tail -n +2)

if test -z "$devices"; then
log "Warning! no devices found"
exit 1
for i in $devices; do

job_id=$(( $j % ${num_jobs} ))

log "Doing device id: $i"
curl -X POST "https://jenkins_url/job/${job_name}_${job_id}/build" --data-urlencode json="{\"parameter\": {\"name\":\"devices\",\"value\":\"${i}\"}}"
j=$(($j + 1));

log "Invocked jenkins without errors"


#N Jenkins job to execution of tests “iOS UI Testing Tests – App Example”

scan –scheme “example_scheme” –destination ‘id=’${devices}

scan is part of fastlane: connect all deployment tools into one streamlined workflow.
scan uses the latest APIs and tools to make running tests plain simple and offer a great integration into your existing workflow, like fastlane or Jenkins.

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someonePrint this page