allow test.sh to collate all tests

so we get one test count and time measurement
This commit is contained in:
Jonathan Lipps 2013-09-16 19:03:23 +02:00
Родитель 364050ce0c
Коммит 27aa99bceb
2 изменённых файлов: 34 добавлений и 8 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -17,6 +17,7 @@ sample-code/examples/php/composer.lock
sample-code/examples/php/composer.phar
sample-code/examples/php/vendor
sample-code/examples/ruby/Gemfile.lock
test/functional/_joined
*.iml
*.autosave
.idea/

41
test.sh
Просмотреть файл

@ -4,6 +4,25 @@ mocha_args=""
ios_only=false
android_only=false
all_tests=true
function join_testfiles {
outfile=$1
rm -rf $outfile
shift
indirs=$@
pre="(function() {"
post="})();"
out=""
touch $outfile
for indir in $indirs; do
for infile in ./test/functional/$indir/*.js; do
echo "$pre\n" >> $outfile
cat $infile >> $outfile
echo "\n$post\n" >> $outfile
done
done
}
for arg in "$@"; do
if [[ "$arg" = "--ios" ]]; then
ios_only=true
@ -17,15 +36,21 @@ for arg in "$@"; do
mocha_args="$mocha_args $arg"
fi
done
alias appium_mocha="mocha -t 60000 -R spec $mocha_args"
appium_mocha="mocha -t 60000 -R spec $mocha_args"
mkdir -p ./test/functional/_joined
if $ios_only || $all_tests; then
appium_mocha test/functional/prefs
appium_mocha test/functional/safari
appium_mocha test/functional/testapp
appium_mocha test/functional/uicatalog
appium_mocha test/functional/webview
ios_tesfile="./test/functional/_joined/ios.js"
ios_dirs=(prefs safari testapp uicatalog webview)
join_testfiles $ios_testfile $ios_dirs
$appium_mocha $ios_testfile
fi
if $android_only || $all_tests; then
appium_mocha test/functional/apidemos
appium_mocha test/functional/selendroid
android_testfile="./test/functional/_joined/android.js"
android_dirs=(apidemos selendroid)
join_testfiles $android_testfile $android_dirs
$appium_mocha $android_testfile
fi