Skip to main content

Filter Cucumber BDD Feature files based on Scenario Tag expressions

Project description

BDD Tag Expression Processor

The module wil filter the Feature files based on the given scenario tag expressions. The expression can be created freehand in the following format.

Rules

  • All the Feature files must have at least a single line space between each block in the feature files.
    • Feature, Background, Scenario, Scenario Outline
  • The Left side is always the ANDs and Right side is always the ORs
  • The bridge between ANDs and ORs is and (
  • Tags that we want to exclude are prefixed with a ~ symbol.
    • Eg. NoRuns can be either the default ~@norun or any tags such as ~@p3
  • All the scenarios that are filtered are arranged back into their original files and a @final tag is placed in the tag list
    • All the comments, and extra spaces are removed from the feature file

Test Samples

Given expression: {@web}
	 Result: --> NoRuns: [],  Ands: ['@web'], Ors: []

Given expression:   {  @web    and @regression    and ~@norun}
	 Result: --> NoRuns: ['@norun'],  Ands: ['@web', '@regression'], Ors: []

Given expression: {~@norun and @web and (@test1 or @test2)}
	 Result: --> NoRuns: ['@norun'],  Ands: ['@web'], Ors: ['@test1', '@test2']

Given expression: {~@norun and (@test1 or @test2)}
	 Result: --> NoRuns: ['@norun'],  Ands: [], Ors: ['@test1', '@test2']

Given expression: {@web and ~@browser and @sanity and ~@norun}
	 Result: --> NoRuns: ['@browser', '@norun'],  Ands: ['@web', '@sanity'], Ors: []

Given expression: {~@norun}
	 Result: --> NoRuns: ['@norun'],  Ands: [], Ors: []

Given expression: {@sanity or @regression}
	 Result: --> NoRuns: [],  Ands: [], Ors: ['@sanity', '@regression']

Given expression: {@web and @browser and ~@norun and (@regression or @Sanity)}
	 Result: --> NoRuns: ['@norun'],  Ands: ['@web', '@browser'], Ors: ['@regression', '@Sanity']

Given expression: {@web and ~@norun and (@regression or @Sanity)}
	 Result: --> NoRuns: ['@norun'],  Ands: ['@web'], Ors: ['@regression', '@Sanity']

Given expression: {  ~@web   and   @browser   and   @checkout   and    ~@norun and (  @regression   or   @Sanity    )}
	 Result: --> NoRuns: ['@web', '@norun'],  Ands: ['@browser', '@checkout'], Ors: ['@regression', '@Sanity']

Given expression: {  ~@web   and   @browser   and   @checkout   and    @norun and (  @test1   or   @test2    )}
	 Result: --> NoRuns: ['@web'],  Ands: ['@browser', '@checkout', '@norun'], Ors: ['@test1', '@test2']

Given expression: {  @web   and   @regression   and    @norun and (  @test1   or   @test2    )}
	 Result: --> NoRuns: [],  Ands: ['@web', '@regression', '@norun'], Ors: ['@test1', '@test2']

Given expression: {@web and (@regression or @Sanity)}
	 Result: --> NoRuns: [],  Ands: ['@web'], Ors: ['@regression', '@Sanity']

Given expression: {  @web   and   ~@browser   and   ~@checkout   and    @norun and (  @regression   or   @Sanity    )}
	 Result: --> NoRuns: ['@browser', '@checkout'],  Ands: ['@web', '@norun'], Ors: ['@regression', '@Sanity']

Given expression: {@web and ~@norun and (@p1)}
	 Result: --> NoRuns: ['@norun'],  Ands: ['@web'], Ors: ['@p1']

Given expression: @web
	 Result: --> NoRuns: [],  Ands: ['@web'], Ors: []

Given expression: 
	 Result: --> NoRuns: [],  Ands: [], Ors: []

Given expression: {~@test-2}
	 Result: --> NoRuns: ['@test-2'],  Ands: [], Ors: []

Given expression: {~@norun and @web}
	 Result: --> NoRuns: ['@norun'],  Ands: ['@web'], Ors: []

HOW-TO Execute on CLI

$ cd $HOME/$projects/pypi-projects/bdd-tags-processor
$ python3 -m bdd_tags_processor.bdd_tags_expression_processor 1 '{  @web   and   ~@browser   and   ~@checkout   and    @norun and (  @regression   or   @Sanity    )}'
Given expression: {  @web   and   ~@browser   and   ~@checkout   and    @norun and (  @regression   or   @Sanity    )}
	Result: --> NORUNs: ['@browser', '@checkout'],  ANDs: ['@web', '@norun'], ORs: ['@regression', '@Sanity']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bdd_tags_processor-0.2.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bdd_tags_processor-0.2.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file bdd_tags_processor-0.2.2.tar.gz.

File metadata

  • Download URL: bdd_tags_processor-0.2.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for bdd_tags_processor-0.2.2.tar.gz
Algorithm Hash digest
SHA256 6893c41466ff18c80ab281969633ed173cfc56fbcab77e25e5ba44c464330e71
MD5 8083dd67eeabf035a203c671b71bc0ee
BLAKE2b-256 6f47fb683b4f20874fedd2db86209ec52737fc61ac32afd154a9caebf434a9be

See more details on using hashes here.

File details

Details for the file bdd_tags_processor-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for bdd_tags_processor-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 52d173cdef75ccd995336e0aca906cead748f82aa1d3a4ddd08846a97efa9d0b
MD5 86475d3bb5b01b2f307d75f618f90d6c
BLAKE2b-256 0932bde6af51f7b6510e2774d74463022e72f6d4ae6bb30e8dc541deee4d1fa1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page