How to use the example table (Parametrised Scenarios) with a normal "Given" expression

when I try to run under the history file, the " resource " statement is executed twice, but I want this execution to run only once, and the " referenced data - sds id = and swift bic = " statement must be executed twice.

Scenario: Parametrised Scenarios Test

Given scenario parameter - swiftBic = JBEHAVEXXX
Given scenario parameter - receiverBic = JBEHAVEYYY
Given scenario parameter - extSdsId = 1111
Given scenario parameter - sdsId = 22222

Given reference data databasetable record <alias> with sds id = <sId> and swift bic = <bic>
Given a stock of.

Examples:
|alias  |sId            |bic            |
|DEF    |${sdsId}       |${swiftBic}    |
|DEFF   |${extSdsId}    |${receiverBic} |

      

+3


source to share


1 answer


In cucumber using Example

there is a shortcut to write the same script twice with different data. So the code above is equivalent to:

Scenario: test with fisrt set of data 
    Given reference data databasetable record DEF with sds id = 2222 and swift bic = JBEHAVEXXX
    Given a stock of.

Scenario: test with second set of data 
    Given reference data databasetable record DEF with sds id = 1111 and swift bic = JBEHAVYYY
    Given a stock of.

      



so if you want a step to Given a stock of.

run as soon as you cannot use a shortcut Example

and must have two separate scripts with explicit steps.

+2


source







All Articles