Skip to content

Commit

Permalink
Added explicit config option
Browse files Browse the repository at this point in the history
  • Loading branch information
mnocon committed Dec 23, 2020
1 parent ccbfb49 commit 238abbd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/ezbehat
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
PROFILE=''
SUITE=''
TAGS=''
CONFIG=''
OTHER_OPTIONS=''
MODE='parallel'
STRICT='--strict'
Expand Down Expand Up @@ -44,19 +45,19 @@ error(){
}

behat(){
${BASH_SOURCE%/*}/behat ${PROFILE}${SUITE}${TAGS}--no-interaction -vv ${STRICT} ${OTHER_OPTIONS}
${BASH_SOURCE%/*}/behat ${CONFIG} ${PROFILE}${SUITE}${TAGS}--no-interaction -vv ${STRICT} ${OTHER_OPTIONS}
}

fastest(){
get_behat_features | ${BASH_SOURCE%/*}/fastest -o -v "${BASH_SOURCE%/*}/behat {} ${PROFILE}${SUITE}${TAGS}--no-interaction -vv ${STRICT} ${OTHER_OPTIONS}"
get_behat_features | ${BASH_SOURCE%/*}/fastest -o -v "${BASH_SOURCE%/*}/behat {} ${CONFIG} ${PROFILE}${SUITE}${TAGS}--no-interaction -vv ${STRICT} ${OTHER_OPTIONS}"
}

# Fastest option 'list-features' gives us the list of all features from given context in random order, which are later
# run in this order in few threads and dynamically distributed between these threads. That gives us different test build
# times each build, often non optimal. To make this optimal we sort features by the number of scenarios in them
# (descending) and run them in that order, to minimize final time gap between the threads.
get_behat_features(){
${BASH_SOURCE%/*}/behat ${PROFILE}${SUITE}${TAGS} --list-scenarios | awk '{ gsub(/:[0-9]+/,"",$1); print $1 }' | uniq -c | sort --reverse | awk '{ print $2 }'
${BASH_SOURCE%/*}/behat ${CONFIG} ${PROFILE}${SUITE}${TAGS} --list-scenarios | awk '{ gsub(/:[0-9]+/,"",$1); print $1 }' | uniq -c | sort --reverse | awk '{ print $2 }'
}

for i in "$@"
Expand All @@ -66,6 +67,7 @@ case $i in
-p=*|--profile=*) PROFILE="--profile=${i#*=} "; ;;
-s=*|--suite=*) SUITE="--suite=${i#*=} ";;
-t=*|--tags=*) TAGS="--tags=${i#*=} ";;
-c=*|--config=*) CONFIG="--config=${i#*=}";;
--non-strict) STRICT='';;
-h|--help) usage; exit 1;;
*) OTHER_OPTIONS="${OTHER_OPTIONS} ${i}";;
Expand Down

0 comments on commit 238abbd

Please sign in to comment.