Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you add an examples table to a background in a cucumber feature file?

Tags:

cucumber

I'm wanting to add an examples table to a background step in a cucumber feature file. How do I go about doing this?

I want to do something like this:

Background:
Given <username> has logged in

Examples:
|username|
|User 1  |
|User 2  |

Scenario: .....
like image 443
Chris Brown Avatar asked Feb 27 '15 14:02

Chris Brown


1 Answers

Does this help you..

Feature: Passing background with multiline args 

Background: 
Given table |a|b| 
|c|d|
And multiline string """ I'm a cucumber
and I'm okay. I sleep all night and I test all day """

Scenario: passing background

Then the table should be 
|a|b| 
|c|d| 

Then the multiline string should be """ I'm a cucumber and I'm okay. I sleep all night and I test all day 

""" Scenario: another passing background 

Then the table should be |a|b| |c|d| 

Then the multiline string should be """ I'm a cucumber and I'm okay. I sleep all night and I test all day

Refer this link for more scenarios..

https://www.relishapp.com/cucumber/cucumber/docs/gherkin/background

like image 141
A user Avatar answered Oct 02 '22 04:10

A user