如何将示例表添加到cucumber要素文件的背景中?

如何将示例表添加到cucumber要素文件的背景中?,cucumber,Cucumber,我想在cucumber功能文件的背景步骤中添加一个示例表。我该怎么做呢 我想这样做: Background: Given <username> has logged in Examples: |username| |User 1 | |User 2 | Scenario: ..... 背景: 给定已登录 示例: |用户名| |用户1| |用户2| 情景:。。。。。 不幸的是,这是不可能的 黄瓜对你有帮助吗 Feature: Passing background with m

我想在cucumber功能文件的背景步骤中添加一个示例表。我该怎么做呢

我想这样做:

Background:
Given <username> has logged in

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

Scenario: .....
背景:
给定已登录
示例:
|用户名|
|用户1|
|用户2|
情景:。。。。。

不幸的是,这是不可能的

黄瓜对你有帮助吗

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
有关更多场景,请参阅此链接


这可能会帮助您:

Background:
    Given Login with email myemail@mail.com and pass myPass

Scenario Outline:Scenario 1

Examples:
  | thing1| thing2 | thing3 |
  | fdlsk | fadsff | faskld |
在您的步骤中,请使用以下命令:

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

好吧,我认为这不可能。假设您的背景中有一个表,那么共享此背景的每个场景也有一个大纲表,那么它将是指数型的。我确实坚持相同的要求。有什么解决办法吗?@PriyaP你找到解决办法了吗?链接断了