0

I want to search for different items in a website multiple times and add the item to cart after each search and proceed to checkout after last search. Cucumber opens the new browser for every row in Exmaples section of Scenario outline row. Is it possible to keep a single browser window open during multiple searches for a website

My feature file is as follows

Feature: Search

Scenario Outline: Search and select item
Given: User is on main page
Then: User enters <item> and click search
Then: User sorts the item
Then: User add the item
Then: Proceed to checkout

Examples:
|item1|
|item2|
|item3|

Any hints what I am doing wrong here??

0

When you use Scenario outline, each example is considered as a single scenario with the scenario outline structure. Think scenario outline as a template where in every example you replace the '<>' with values form each example row and run separately

You could use tables to add multiple items in the same cart separately

Scenario: Search and select items
  Given User is on main page
  When User enters, sort and add to cart the following items separately
    |Item1|Item2|Item3|
  Then Proceed to checkout

Another way to do this could be something like (in declarative way)

Scenario: Search and select items
   Given user is on main page
   When search and add to cart multiple items
   Then proceed to checkout

Then you have to resolve internally the When step at a step level. This way aims to focus on what you want to describe at user level and not how you do it.

Hope it help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.