#!/bin/sh #set -x set -e # https://github.com/plu/parallel_ios_tests # Add this command line arg to your scheme : ${COMMANDLINE_APP_ARGUMENTS} # To have a list of available devicetypes : # xcrun simctl list devicetypes echo "set devicetypes/languages/scheme(s) before launching this script" ; exit 12 declare -a devicetypes=("iPhone-4s" "iPhone-5" "iPhone-6" "iPhone-6-Plus") declare -a languages=("fr" "en") declare -a schemes=("TODO") for scheme in "${schemes[@]}"; do xcodebuild build -sdk iphonesimulator -scheme $scheme -derivedDataPath ./DerivedData ONLY_ACTIVE_ARCH=NO RUN_CLANG_STATIC_ANALYZER=NO VALID_ARCHS="i386 x86_64" ARCHS="i386 x86_64" | xcpretty done echo "Finished initial project compilation" ## now loop through the devices / langs / schemes (e.g. apps) for device in "${devicetypes[@]}"; do set +e xcrun simctl shutdown screenshot_$device xcrun simctl delete screenshot_$device set -e RUNTIME=$(xcrun simctl list runtimes | grep "com.apple.CoreSimulator.SimRuntime.iOS" | awk '{print $NF}') UDID=$(xcrun simctl create screenshot_$device com.apple.CoreSimulator.SimDeviceType.$device $RUNTIME) for lang in "${languages[@]}"; do for scheme in "${schemes[@]}"; do COMMANDLINE_APP_ARGUMENTS="-AppleLanguages ($lang)" xcodebuild test -scheme $scheme -destination name="screenshot_$device" -derivedDataPath ./DerivedData -only-testing:OTKTestAppTests/OTKScreenshotsTests RUN_CLANG_STATIC_ANALYZER=NO | xcpretty mkdir -p screenshots/${scheme}_$lang/$device mv /tmp/${scheme}*.jpg screenshots/${scheme}_$lang/$device/ done done set +e xcrun simctl shutdown screenshot_$device xcrun simctl delete screenshot_$device set -e done