Forum

Welcome to the community! Register below to add topics and replies.

You need to log in to create posts and topics.

How to write data-driven Cucumber tests

Sometimes it's great to use the Examples key-word to drive data loops. It's bad practice to over-use data in the Feature file - only put that that is relevant to the business, not developer test-data.

Also, use n-wise/pairwise testing practices to reduce the number of data rows.

@Discount

Feature: Discount Management
This feature covers the basic discount scenarios.@Smoke @Debug
Scenario Outline: Order product with different discounts

"""
Orders a product with different discounts

"""
Given I am a brewer
and I add a product
and I set inventory to price <price>, discount dollars <discount_dollars>,
percentage <discount_percentage>, and special price <special_price>
When I order <order_quantity> products
Then the order details should have subtotal <subtotal>

Examples:

|price|order_quantity|discount_dollars|discount_percentage|special_price|subtotal|
|20.00|1             |5.99            |bz-skip            |bz-skip      |14.01   |
|10.00|1             |bz-skip         |25                |bz-skip      |7.50    |
|32.99|1             |bz-skip        |bz-skip            |8.99         |8.99    |
|9.81 |10            |bz-skip        |15                 |bz-skip      |83.39  |
|7.15 |10            |bz-skip         |15                |bz-skip      |60.78   |

 

 

Create your account for free!

No credit card required.