Commit b81abace authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Merge branch 'feature/behat-parameters' into '2.x'

Add a <tags> argument to the <test> command

We can now filter which scenarios are run by behat.

See merge request !4
parents e79b5bdf 36444006
...@@ -6,6 +6,8 @@ This project adheres to http://semver.org/[Semantic Versioning]. ...@@ -6,6 +6,8 @@ This project adheres to http://semver.org/[Semantic Versioning].
== [Unreleased] == [Unreleased]
* Add a "tags" argument to the "test" command in order to limit which scenarios are run by behat.
=== Fixed === Fixed
* Site name can now have whitespaces without breaking the shell execution string * Site name can now have whitespaces without breaking the shell execution string
......
...@@ -25,16 +25,19 @@ def init(): ...@@ -25,16 +25,19 @@ def init():
@task @task
def test(): def test(tags=''):
""" """
Setup Behat and run the complete tests suite. Default output formatters: pretty and JUnit. 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. 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.init)
if not tags:
execute(behat.run) execute(behat.run)
else:
execute(behat.run, tags='{}'.format(tags))
......
...@@ -51,7 +51,7 @@ def install(): ...@@ -51,7 +51,7 @@ def install():
@task @task
@roles('docker') @roles('docker')
def run(): def run(tags='~@wip&&~@disabled&&~@test'):
""" """
Execute the complete Behat tests suite. Execute the complete Behat tests suite.
:param role Default 'role' where to run the task :param role Default 'role' where to run the task
...@@ -68,8 +68,5 @@ def run(): ...@@ -68,8 +68,5 @@ def run():
if not h.fab_exists(role, '{}/tests/behat/behat.yml'.format(workspace)): if not h.fab_exists(role, '{}/tests/behat/behat.yml'.format(workspace)):
init() init()
with h.fab_cd(role, '{}/tests/behat'.format(workspace)): with h.fab_cd(role, '{}/tests/behat'.format(workspace)):
h.fab_run(role, 'behat --format junit --format pretty --tags "~@wip&&~@disabled&&~@test" --colors') h.fab_run(role, 'behat --format junit --format pretty --tags "{}" --colors'.format(tags))
# 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')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment