From 27aa99bceb8df749f66a992aaa2a7903b1f351fb Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Mon, 16 Sep 2013 19:03:23 +0200 Subject: [PATCH] allow test.sh to collate all tests so we get one test count and time measurement --- .gitignore | 1 + test.sh | 41 +++++++++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index a2e4d01bb..5c9175e26 100644 --- a/.gitignore +++ b/.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/ diff --git a/test.sh b/test.sh index 4b70a2f23..59b49a47f 100755 --- a/test.sh +++ b/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