17

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?

Cœur
  • 32,421
  • 21
  • 173
  • 232
sensorario
  • 15,862
  • 24
  • 85
  • 131

2 Answers2

42

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

Jakub Zalas
  • 33,992
  • 9
  • 84
  • 118
  • I wonder if you would have a solution [this post](http://stackoverflow.com/questions/26383870/runing-behat-tests-in-parallel-in-two-browser-windows)? – BentCoder Oct 16 '14 at 10:08
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'
esl4m
  • 91
  • 1
  • 5