diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 4da22ee548ff60b3c5a716f17a534e4584cd8fa0..af7b4410cf216cd9456e644ded7f113d37f81de8 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -6,6 +6,8 @@ This project adheres to http://semver.org/[Semantic Versioning]. == [Unreleased] +* Add a "tags" argument to the "test" command in order to limit which scenarios are run by behat. + === Fixed * Site name can now have whitespaces without breaking the shell execution string diff --git a/__init__.py b/__init__.py index 3a01e81cbe4390b3323c81790bcf3b8ae3265226..ffa606ec74e90c757f5f35fb04907b20d7648378 100644 --- a/__init__.py +++ b/__init__.py @@ -25,16 +25,19 @@ def init(): @task -def test(): +def test(tags=''): """ Setup Behat and run the complete tests suite. Default output formatters: pretty and JUnit. The JUnit report file is specified in the Behat configuration file. Default: tests/behat/out/behat.junit.xml. - :param tag Specific Behat tests tags to run. + :param tags Specific Behat tests tags to run. """ execute(behat.init) - execute(behat.run) + if not tags: + execute(behat.run) + else: + execute(behat.run, tags='{}'.format(tags)) diff --git a/behat.py b/behat.py index 3391556479aa9240f3c3c3abfdf6988e653f5b74..9409d70db021c505ef6648e5dc3f0d65ab8fd717 100644 --- a/behat.py +++ b/behat.py @@ -51,7 +51,7 @@ def install(): @task @roles('docker') -def run(): +def run(tags='~@wip&&~@disabled&&~@test'): """ Execute the complete Behat tests suite. :param role Default 'role' where to run the task @@ -68,8 +68,5 @@ def run(): if not h.fab_exists(role, '{}/tests/behat/behat.yml'.format(workspace)): init() with h.fab_cd(role, '{}/tests/behat'.format(workspace)): - h.fab_run(role, 'behat --format junit --format pretty --tags "~@wip&&~@disabled&&~@test" --colors') - # To run behat with only one test for example, comment previous line - # and uncomment next one - # fab_run(role, 'behat --format pretty --tags "~@wip&&~@disabled&&@yourTest" --colors') + h.fab_run(role, 'behat --format junit --format pretty --tags "{}" --colors'.format(tags))