How to add an example table in the background to the cucumber description file?

I want to add an example table in the background step to the cucumber description file. How can I do it?

I want to do something like this:

Background: Given <username> has logged in Examples: |username| |User 1 | |User 2 | Scenario: ..... 
+9
source share
3 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 to this link for more scenarios.

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

+3
source

Unfortunately this is not possible.

Cucumber docs

+1
source

Maybe this can help you:

 Background: Given Login with email myemail@mail.com and pass myPass Scenario Outline:Scenario 1 Examples: | thing1| thing2 | thing3 | | fdlsk | fadsff | faskld | 

And in your report use this:

 @Then("^Login Login with email ([^\"]*) and pass ([^\"]*)$") public void login_general(String email, String pass) { login.fillEmail(email); login.fillPass(pass); login.clickLogin(); } 
0
source

Source: https://habr.com/ru/post/983105/


All Articles