Burn OR syntax to reduce repetition with BDD

Does anyone know how to achieve this or they consider it a good idea. To have Gherkin's OR style syntax to reduce repetition, but maintaining human readability (hopefully). I think of cases where combinations of sentences expand with each combination of several OR statements. eg.

Scenario: TestCopy
  Given Some text is selected
  When The user presses Ctrl + C
    OR the user right clicks and selects copy
    OR the user selects Edit + Copy
  Then the text is copied to the clipboard

This will run as 3 tests each with the same given, and then with one when from the OR set. I suppose this could be achieved using a template with a space holder for the When clause, but I think it is more readable and might allow OR to be used in this, as well as for creating nx m tests. With the outline, you will need the lines nx m.

  • Is there a better way to do this
  • Am I better off copying and pasting explicitly (I think the service might get messy).
  • Do other frameworks support this (I think using FIT you can write a user table, but again this is overhead)

Thank.

+5
source share
4 answers

You can generate multiple tests from one script using Script Script:

Scenario Outline: TestCopy
  Given Some text is selected
  When <Copy operation executed>
  Then the text is copied to the clipboard

Examples: 
    | Copy operation executed                |
    | The user presses Ctrl + C              |
    | the user right clicks and selects copy |
    | the user selects Edit + Copy           |

In Scenario Outlineyou basically create a template that is populated with Examples.
For the above example will generate Specflow 3 tests with the same Givenand Thenwith different 3 Whens:

When The user presses Ctrl + C
When the user right clicks and selects copy
When the user selects Edit + Copy
+11
source

( , ) . , , . , , .

. :

Scenario: TestCopy
  Given some text is selected
  When the user copies the selected text
  Then the selected text is copied to the clipboard

.

+9

n x m, , , , , , .

, , - :

Given A block of text is selected
OR An image is selected
OR An image and some text is selected
When The user presses Ctrl + C
OR the user right clicks and selects copy
OR the user selects Edit + Copy

Then .

... , @nemesv, "".

Scenario Outline: TestCopy
  Given I have made a selection
  When <Copy operation executed>
  Then my selection is copied to the clipboard

Examples: 
  | Copy operation executed                |
  | The user presses Ctrl + C              |
  | the user right clicks and selects copy |
  | the user selects Edit + Copy           |

" " - , , , - , , delete... ctrl-v... ?

, , .

+4

, . , . copy/paste, , , .

0

All Articles