From e5d77bbd953e9d825a9371ed70c59f460af72a67 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Mon, 13 May 2013 15:59:07 +0800 Subject: [PATCH] Specify tags when running behat --- extra/bash_completion | 2 +- lib/commands/behat.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/extra/bash_completion b/extra/bash_completion index 2efbac0..21c909d 100644 --- a/extra/bash_completion +++ b/extra/bash_completion @@ -80,7 +80,7 @@ function _moodle() { OPTS="$(compgen -A file $CUR)" compopt -o nospace else - OPTS="--run --disable --feature --switch-completely --no-javascript --selenium --selenium-verbose" + OPTS="--run --disable --feature --switch-completely --no-javascript --selenium --selenium-verbose --tags" OPTS="$OPTS $($BIN info -ln)" fi ;; diff --git a/lib/commands/behat.py b/lib/commands/behat.py index 00a8f2a..73967f2 100644 --- a/lib/commands/behat.py +++ b/lib/commands/behat.py @@ -57,11 +57,18 @@ class BehatCommand(Command): } ), ( + ['-t', '--tags'], + { + 'metavar': 'tags', + 'help': 'only execute the features or scenarios with tags matching tag filter expression' + } + ), + ( ['-j', '--no-javascript'], { 'action': 'store_true', 'dest': 'nojavascript', - 'help': 'skip the tests involving Javascript' + 'help': 'do not start Selenium and ignore Javascript (short for --tags=~@javascript). Cannot be combined with --tags.' } ), ( @@ -170,7 +177,9 @@ class BehatCommand(Command): # Preparing Behat command cmd = ['vendor/bin/behat'] - if nojavascript: + if args.tags: + cmd.append('--tags=%s' % (args.tags)) + elif nojavascript: cmd.append('--tags ~@javascript') cmd.append('--config=%s/behat/behat.yml' % (M.get('behat_dataroot'))) -- 2.11.0