It is possible to exclude a tag with Behat?
Asked Answered
D

3

18

I know the way to run only the tests tagged with a chosen @tag:

@invite
Feature: As User I want to invite a friend to join on MySocial

  @mytag
  Scenario: Exists a Facebook user
    Given I go to "/"
    When I follow "Invite a friend"
    ...

Is is possible to do exactly the opposite?

Donyadoodad answered 24/2, 2014 at 9:12 Comment(0)
B
48

Yes, it is possible to exclude a tag or a list of tags from the command line:

behat --tags '~@javascript'

It is also possible to set excluded (and included) tags in a profile in behat.yml.

Behat 2.x

default:
  filters:
    tags: "~@wip&&~@postponed&&~@disabled"

In the example above I exclude anything that's taged @wip (work in progress), @postponed or @disabled.

Behat 3.x

In Behat 3, you can not only configure tags for profiles, but also for suites. The syntax is a bit different:

default:
    gherkin:
        filters:
            tags: "~@wip&&~@disabled"

suites:
    admin:
        filters:
            tags: "@admin"

Related docs

Bellaude answered 24/2, 2014 at 17:0 Comment(1)
I wonder if you would have a solution this post?Impecunious
I
6

If you want to just do one tag like Jakub said :

behat --tags '~@javascript'

if you want to run multiple scenarios with tags like @Done and not @javascript :

behat --tags '@Done&&~@javascript'
Ineslta answered 5/5, 2016 at 11:19 Comment(0)
D
0

It skips the scenario and feature but it result in error that no scenario found. It should be passed . Is there any way to pass feature having all skipped scenarios executed through command.

Disrate answered 16/4, 2022 at 13:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.