Created
November 4, 2015 15:10
-
-
Save lepistone/1494fdad5350b48e155f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
USAGE="Discover Features and launch behave to run OERPScenarios\n | |
\n | |
oerpscenario [options]\n | |
\n | |
Options:\n | |
-t <TAG_EXPRESSION>: run Features / Scenarios tagged with TAG_EXPRESSION (see below)\n | |
--help-behave: display behave help (to know which behave options you can pass\n | |
-h or --help: display this help\n | |
\n | |
TAG_EXPRESSION (extracted from behave --tags-help):\n | |
\n | |
TAG_EXPRESSION is simply a tag:\n | |
\n | |
--tags @dev\n | |
\n | |
You may even leave off the "@" - behave doesn't mind.\n | |
\n | |
When a tag in a tag expression starts with a ~, this represents boolean NOT:\n | |
\n | |
--tags ~@dev\n | |
\n | |
A tag expression can have several tags separated by a comma, which represents\n | |
logical OR:\n | |
\n | |
--tags @dev,@wip\n | |
\n | |
The --tags option can be specified several times, and this represents logical\n | |
AND, for instance this represents the boolean expression\n | |
'(@foo or not @bar) and @zap':\n | |
\n | |
--tags @foo,~@bar --tags @zap.\n | |
\n | |
Beware that if you want to use several negative tags to exclude several tags\n | |
you have to use logical AND:\n | |
\n | |
--tags ~@fixme --tags ~@buggy.\n | |
" | |
BEHAVE=`dirname $0`/behave | |
BEHAVE_FLAGS="-k --no-capture" | |
ROOTDIR=`dirname $0`/.. | |
BASIC_FEATURES=$${ROOTDIR}/${oerpscenario:branch-directory}/features | |
FIND_FLAGS="-not -path $${BASIC_FEATURES} -a -name features" | |
if [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then | |
echo -e $${USAGE} | |
elif [ "$1" == "--help-behave" ] ; then | |
$${BEHAVE} --help | |
elif [ "$1" == "--tags-help" ] ; then | |
$${BEHAVE} --tags-help | |
else | |
if (echo "$*" | grep --quiet -- '--pdb') ; then | |
export BEHAVE_DEBUG_ON_ERROR=1 | |
export OTHER_FLAGS=$(echo $* | sed 's/--pdb//') | |
else | |
export OTHER_FLAGS=$* | |
fi | |
OTHER_FEATURES=`find $${ROOTDIR} $${FIND_FLAGS} -printf "%p "` | |
$${BEHAVE} $${BEHAVE_FLAGS} $${OTHER_FLAGS} $${BASIC_FEATURES} $${OTHER_FEATURES} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment