Resources:

Repository: https://github.com/anton-lin/tag-expressions-python

Behave Documentation for tags: https://behave.readthedocs.io/en/latest/tag_expressions.html

package name: : https://pypi.org/project/cucumber-tag-expressions/

My Feature File

@regression
Feature: showing off behave

  @slow
  Scenario: run a slow test
    Given we have behave installed
    When we implement a test
    Then behave will test it for us!

  @wip
  Scenario: run a wip test
    Given we have behave installed
    When we implement a test
    Then behave will test it for us!

  @wip @slow
  Scenario: run a wip and slow test
    Given we have behave installed
    When we implement a test
    Then behave will test it for us!

Tried commands none of them working: getting results zero scenarios are run

behave --tags="not @slow" .\features\tutorial.feature
behave --tags="@slow and @wip" .\features\tutorial.feature
behave --tags="@slow or @wip" .\features\tutorial.feature

While command with single tag is working fine and executing only scenarios of that specific tag

Getting Below outcome with all three commands:

@regression
Feature: showing off behave # features/tutorial.feature:2

  @slow
  Scenario: run a slow test          # features/tutorial.feature:5
    Given we have behave installed   # None
    When we implement a test         # None
    Then behave will test it for us! # None

  @wip
  Scenario: run a wip test           # features/tutorial.feature:11
    Given we have behave installed   # None
    When we implement a test         # None
    Then behave will test it for us! # None

  @wip @slow
  Scenario: run a wip and slow test  # features/tutorial.feature:17
    Given we have behave installed   # None
    When we implement a test         # None
    Then behave will test it for us! # None

0 features passed, 0 failed, 1 skipped
0 scenarios passed, 0 failed, 3 skipped
0 steps passed, 0 failed, 9 skipped, 0 undefined
Took 0m0.000s
1

There are 1 best solutions below

1
On

'and'/'or' usage as you have attempted is not available in python-behave 1.2.6.

For 1.2.6 try instead:

OR example:

behave --tags @slow,@wip

AND example:

behave --tags @slow, --tags @wip

Negative tag example:

behave --tags ~@slow

See further docs with

behave --tags-help

The reason for the confusion is that when you install behave, by default you pull the most recent stable version from places like pypi.org (so 1.2.6), while the behave docs refer to the "latest" version (1.2.7, which has been in development for quite some time now). The same issue was raised and closed a while ago in github and closed.