Skip to content

Instantly share code, notes, and snippets.

@Gonzales
Created July 3, 2013 13:00
Show Gist options
  • Save Gonzales/5917674 to your computer and use it in GitHub Desktop.
Save Gonzales/5917674 to your computer and use it in GitHub Desktop.
Calabash-iOS cucumber runner. This can allow you to organize your features in different folders (country specific in this case) and run separately or altogether. For Example: "sh ./cacik.sh iPhone de 0" will run all tests under de folder for iPhone and won't run master tests
#!/bin/bash
#test comments
appName="YourAppName"
defaultdevice=$1
defaultlocale=$2
willmasterrun=$3
if [ "$#" -ne 3 ] ; then
echo "$0: exactly 3 arguments expected"
exit 3
fi
if [ -z "$1" ]
then
echo "not enough arguments were supplied: *usage : cacik.sh device locale \n Example: sh ./cacik.sh iPhone de 0"
exit 1
fi
if [ -z "$2" ]
then
echo "not enough arguments were supplied: *usage cacik.sh device locale master_folder_included"
exit 1
fi
if [ $3 -eq 1 ]
then
echo " *********************************\n "
echo " Running UI tests for MASTER\n"
echo " *********************************\n "
#setting up device
calabash-ios sim device $defaultdevice
#run master
cucumber -r features features/master
fi
echo " *********************************\n "
echo " Running UI tests for MARKETS\n"
echo " *********************************\n "
var=$2
IFS=" ,"
i=0
for val in ${var}
do
i=$((++i))
eval var${i}="${val}"
done
for ((j=1;j<=i;++j))
do
name="var${j}"
language=${!name:0:1}
# language= "${!name}"
#region= ${name:3:7}
echo "${!name:0:2} ${!name:3:5}"
# echo ${name}=${!name}
# echo " Running UI tests for locale:${!name} and $defaultdevice"
echo " Running UI tests for locale:${!name:0:2} ${!name:3:5} and $defaultdevice"
#setting up region
calabash-ios sim locale ${!name:0:2} ${!name:3:5}
#run tests
numberofletters="${!name}"
# echo "Number of letters: ${#numberofletters} and string: $numberofletters"
if [ ${#numberofletters} -eq 2 ]
then
#echo " 2 letters"
cucumber -r features features/"${!name:0:2}"
else
#echo " 5 letters"
cucumber -r features features/"${!name:0:2} ${!name:3:5}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment