dimanche 23 septembre 2018

Cucumber for REST, writing feature file when having duplicate steps

I am having trouble on writing the feature file as I currently wanted to have multiple step definitions on each scenario. Here is my feature file:

Feature: Add new voucher
   As a user I want to be able to add vouchers

Scenario Outline: Add new voucher with an invalid voucher
    Given a trip voucher <Voucher>
    When I access "/voucher" endpoint
    Then error message should be "Voucher is invalid"

Examples:
  |Voucher    |
  |ABCDEFG    |
  |1234567    |
  |invaL!Ds   |

Scenario Outline: Add a previously redeemed voucher
    Given a used voucher <Voucher>
    When I access "/voucher" endpoint
   Then error message should be "Voucher has already been used"

Examples:
  |Voucher        |
  |VALIDVOUCHER   |

I am working on building a REST API on Go, while learning to create integration tests on Java because the QAs are using for testing. What is the best practice here on line When I access x endpoint? I know it will produce the Duplicate step definition error. Should I change how I wrote the feature file, or there are Java tricks that I am missing out.

Aucun commentaire:

Enregistrer un commentaire