我想对几个测试用例执行通用步骤。以下是通用步骤。但是在后台,由于我无法使用方案大纲,因此还有什么替代方法?
Background:To test employee id search
Scenario Outline:
Given I am on login Screen
When I enter credentials "<User_ID>" and "<Password>"
When I clicks on search button
And search by "<Employee_id>"
Examples:
|User_ID|Password |Employee_id|
|Admin |Password | Q58ewQ |
答案 0 :(得分:0)
方案概述是一种运行多个方案而只编写一个方案的方法。背景是在每个方案之前要运行的一组步骤。您不能在背景中放置轮廓,这没有任何意义。
答案 1 :(得分:0)
Background用于将在功能文件的每个场景(或示例)之前运行的步骤。
每个Scenario Outline将作为单独的Scenario / Example运行。
您不能在背景“ 内部”中使用方案大纲,因为这毫无意义。
请查看文档链接以获取更多信息。
答案 2 :(得分:0)
这是非常必要的示例,BDD需要声明。 Best Pratices BDD
为什么要创建一种可以登录的方法。
Login(username, password){
set username = username;
set password = password;
clickButton;
}
并创建一个步骤。
Given the user logged on the system
login(username, password)
这是您与背景一起使用的步骤。
答案 3 :(得分:0)
您可以在 Cucumber Background
中使用表格:
Background:
Given I open Google's search page
When I use the following keywords to search in the Google's search page:
| CucumberBDD |
| CucumberHooks |
答案 4 :(得分:0)
您可以在 Data Table
中使用 Cucumber Background
:
Background:
Given User is on Home Page
When User Navigate to LogIn Page
And User enters Credentials to LogIn
| testuser_1 | Test@153 |