我的示例功能文件,而不是提供示例中的数据,我希望它从 csv 传递如何实现,任何人都可以帮助我.
My sample feature file rather than giving data from Examples I want it to pass from csv how to achieve that can anyone help me out.
功能文件:
Feature: Rocky Search Status
Scenario Outline: Rocky Search Status with Filters
Given Open firefox and start application for Rocky Search Status
When User enters "<price_right>" and "<Carat_left>" and "<Color_right_param>" and "<Cut_right_param>" and "<Clarity_right_param>"
Then Message displayed Rocky Search Status Successful
Then Application should be closed after Rocky Search Status
Examples:
| price_right | Carat_left | Color_right_param | Cut_right_param | Clarity_right_param |
| 10000 | 1.5 | 80 | 180 | 84 |
我希望在项目外部以 CSV 格式定义数据值.
I want the data values to be defined in CSV outside the Project.
你不能用 Gherkin.您可以做的是给您的 CSV 文件一个适当的名称,在 Gherkin 步骤中引用该名称,然后在您的步骤定义中加载并读取该文件.
You can't with Gherkin. What you can do is to give your CSV file an appropriate name, refer to the name inside your Gherkin step, and then load and read the file inside your step definition.
abc.feature
Feature: A
Scenario: 1
Given data at abc.csv
...
step-definitions.js
Given(/^data at (.*)$/, function (fileName) {
const data = jsonfile.readFileSync(`${__dirname}/${fileName}`);
// iterate over data
})
上一篇:在OpenGL ES 2.0在Android上黑色文物文物、黑色、ES、OpenGL
下一篇:滚动后gridview的细胞观察位置的变化...色被设定为不同的细胞比点击一个其它细胞、位置、不同、gridview