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: []

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.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

bdd_tags_processor-0.2.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bdd_tags_processor-0.2.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for bdd_tags_processor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 222f7fa0cc17d4e14d95390762dea535952c4348fbffb37cff3f858ee0ed4d51
MD5 9f815bcaee29ba4f8622bc452a2d7ad3
BLAKE2b-256 96629a3ab56bc22dfc4d567660ffd216652429824ad17f3815435544a18f95e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bdd_tags_processor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cabde7e698c4c59443fea0a10aba0e427fcb7cbcf866a08f509cc48054f724f7
MD5 2996b9e781fcdad750f23d79d9e11ca6
BLAKE2b-256 056bda3592ae130c21153fe1c0dfcc5ad7b48dbbaf47a86d7d762d2706dfb629

See more details on using hashes here.

Supported by

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