QAF-Java BDD: How to use asterisk (*) instead of Given When Then keyword

45 views
Skip to first unread message

Renish K.R

unread,
Jun 1, 2024, 10:43:42 AM6/1/24
to qaf users
How can I use * (asterisk) instead of normal keywords like Given When Then in BDD? Cucumber official allows *.
Note: I have tried adding BDD Keyword Synonyms like below:

And=Provided;*

And=Provided;\*

Error with above Synonyms:
Dangling meta character '*' near index 31 ^(Given|When|Then|And|Provided|*|Using|Having|With)

Error without Synonyms:
Dangling meta character '*' near index 48 (((^(Given|When|Then|And|Using|Having|With))\s)?* Some step here ((\{.*})|(\[.*])|('([^\\']|\\\\|\\')*')|("([^\\"]|\\\\|\\")*")|([-+]?\d+(\.\d+)?)))

cjayswal

unread,
Jun 1, 2024, 1:45:59 PM6/1/24
to qaf users
Will you provide details what you want to achieve with few examples?
When using BDD or BDD2 factory, Given/when/then/and/... are optional.

Renish K.R

unread,
Jun 2, 2024, 8:00:08 AM6/2/24
to qaf users

Sample Scenario:
Feature: Sample module Scenario: Open Google and take snapshot * Open URL "http://www.google.com" * Take screenshotI want to use asterisk (*) as keyword. This is allowed in Cucumber language 


Below reference from above link:

Gherkin also supports using an asterisk (*) in place of any of the normal step keywords. This can be helpful when you have some steps that are effectively a list of things, so you can express it more like bullet points where otherwise the natural language of And etc might not read so elegantly.

For example:

Scenario: All done Given I am out shopping And I have eggs And I have milk And I have butter When I check my list Then I don't need anything

Could be expressed as:

Scenario: All done Given I am out shopping * I have eggs * I have milk * I have butter When I check my list Then I don't need anything

Renish K.R

unread,
Jun 3, 2024, 4:51:10 AM6/3/24
to qaf users
I have figured out the solution to add asterisks as Synonyms

And=Provided;\\*

Add 2 backslashes to escape.
Reply all
Reply to author
Forward
0 new messages