Skip to content

Commit

Permalink
Add quotes to certain YAML strings
Browse files Browse the repository at this point in the history
According to Behat/Behat#1216 the recent YAML parser throws an error when encountering unquotes strings with special characters.
  • Loading branch information
SvenRtbg committed Sep 4, 2019
1 parent 700a559 commit 155d21e
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions user_guide/configuration/suites.rst
Expand Up @@ -17,14 +17,14 @@ really powerful and ``behat.yml`` makes them that much more powerful:
default:
suites:
core_features:
paths: [ %paths.base%/features/core ]
paths: [ '%paths.base%/features/core' ]
contexts: [ CoreDomainContext ]
user_features:
paths: [ %paths.base%/features/web ]
paths: [ '%paths.base%/features/web' ]
filters: { role: user }
contexts: [ UserContext ]
admin_features:
paths: [ %paths.base%/features/web ]
paths: [ '%paths.base%/features/web' ]
filters: { role: admin }
contexts: [ AdminContext ]
Expand All @@ -42,9 +42,9 @@ configuration:
suites:
core_features:
paths:
- %paths.base%/features
- %paths.base%/test/features
- %paths.base%/vendor/.../features
- '%paths.base%/features'
- '%paths.base%/test/features'
- '%paths.base%/vendor/.../features'
As you might imagine, this option tells Behat where to search for test features.
You could, for example, tell Behat to look into the
Expand All @@ -57,7 +57,7 @@ You could, for example, tell Behat to look into the
default:
suites:
web_features:
paths: [ %paths.base%/features/web ]
paths: [ '%paths.base%/features/web' ]
contexts: [ WebContext ]
You then might want to also describe some API-specific features in
Expand All @@ -70,10 +70,10 @@ You then might want to also describe some API-specific features in
default:
suites:
web_features:
paths: [ %paths.base%/features/web ]
paths: [ '%paths.base%/features/web' ]
contexts: [ WebContext ]
api_features:
paths: [ %paths.base%/features/api ]
paths: [ '%paths.base%/features/api' ]
contexts: [ ApiContext ]
This will cause Behat to:
Expand All @@ -87,7 +87,8 @@ This will cause Behat to:
.. note::

``%paths.base%`` is a special variable in ``behat.yml`` that refers
to the folder in which ``behat.yml`` is stored.
to the folder in which ``behat.yml`` is stored. When using it, or
any other percent-encased variable, it has to be put in quotes.

Path-based suites are an easy way to test highly-modular applications
where features are delivered by highly decoupled components. With suites
Expand All @@ -109,15 +110,20 @@ features with specific tag (or name) in specific contexts:
default:
suites:
web_features:
paths: [ %paths.base%/features ]
paths: [ '%paths.base%/features' ]
contexts: [ WebContext ]
filters:
tags: @web
tags: '@web'
api_features:
paths: [ %paths.base%/features ]
paths: [ '%paths.base%/features' ]
contexts: [ ApiContext ]
filters:
tags: @api
tags: '@api'
.. note::

The `@` character is a special and requires the tag to be
put in quotes.

This configuration will tell Behat to run features and scenarios
tagged as ``@web`` in ``WebContext`` and features and scenarios
Expand All @@ -133,12 +139,12 @@ filter. That means, you can now have nice actor-based suites:
default:
suites:
user_features:
paths: [ %paths.base%/features ]
paths: [ '%paths.base%/features' ]
contexts: [ UserContext ]
filters:
role: user
admin_features:
paths: [ %paths.base%/features ]
paths: [ '%paths.base%/features' ]
contexts: [ AdminContext ]
filters:
role: admin
Expand Down Expand Up @@ -173,7 +179,7 @@ This is achieved by specifying the filter in the gherkin configuration:
default:
gherkin:
filters:
tags: ~@wip
tags: '~@wip'
In this instance, scenarios tagged as @wip will be ignored unless the CLI
command is run with a custom filter, e.g.:
Expand Down Expand Up @@ -204,13 +210,13 @@ develop different layers of your application with Behat:
default:
suites:
domain_features:
paths: [ %paths.base%/features ]
paths: [ '%paths.base%/features' ]
contexts: [ DomainContext ]
web_features:
paths: [ %paths.base%/features ]
paths: [ '%paths.base%/features' ]
contexts: [ WebContext ]
filters:
tags: @web
tags: '@web'
In this case, Behat will first run all the features from the ``features/``
folder in ``DomainContext`` and then only those tagged with ``@web`` in
Expand All @@ -221,4 +227,4 @@ folder in ``DomainContext`` and then only those tagged with ``@web`` in
It might be worth reading how to :ref:`execute a specific
suite<user-guide--command-line-tool--identifying-tests--by-suite>` or
:ref:`initialize a new
suite<user-guide--initialize-a-new-behat-project--suite-initialisation>`
suite<user-guide--initialize-a-new-behat-project--suite-initialisation>`

0 comments on commit 155d21e

Please sign in to comment.