我可以运行具有2种不同背景的相同功能文件吗?我可以参数化2种情景的背景。
以下是功能文件:
@Smoke
Feature: Login to the application
Background:
Given Launch "<Browser_type>" Browser
Scenario: Logging into the application
Given I open the application
|Application_Name|
|Kohls |
|Gymboree |
Then I give username and password
|Username |Password|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
When I click submit button
Then I enter into my application page
Scenario: Logging into the application
Given I open the application
|Application_Name|
|Kohls |
|Gymboree |
Then I give username and password
|Username |Password|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
When I click submit button
Then I enter into my application page
Examples:
|Browser_type |
|Chrome |
|Firefox |
当我执行它时,我收到错误
java.lang.RuntimeException:cucumber.runtime.CucumberException:解析特征文件Login.feature时出错
答案 0 :(得分:0)
此解决方案使用场景大纲并删除功能
中的背景示例:
@Smoke Feature: Login to the application
Scenario Outline: Logging into the application
Given Launch "<Browser_type>" Browser
Given I open the application
|Application_Name|
|Kohls |
|Gymboree |
Then I give username and password
|Username |Password|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
When I click submit button
Then I enter into my application page
Examples:
|Browser_type |
|Chrome |
|Firefox |
Scenario Outline: Logging into the application
Given Launch "<Browser_type>" Browser
Given I open the application
|Application_Name|
|Kohls |
|Gymboree |
Then I give username and password
|Username |Password|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
When I click submit button
Then I enter into my application page
Examples:
|Browser_type |
|Chrome |
|Firefox |
希望这可以帮助你...