我正在使用量角器黄瓜框架
这是功能文件
Feature: welcome to protractor cucumber
Scenario Outline: DataTable
Given I am learning
Then I print following table
Examples:
| First | Middle |
| qwerty | xyz |
在步骤定义文件中,我想打印表数据。
Given(/^I am learning$/, async () => {
console.log("I am learning");
});
Then(/^I print following table$/, (table: TableDefinition) => {
const tableData = table.rows();
console.log(tableData[0][0]);
});
但是得到以下错误
TypeError: table.rows is not a function
at World.(anonymous) (/.../Protr_cucumber/stepDef/Sample_stepDef.ts:9:29)
您正在混淆场景大纲和数据表。
当您想要执行具有多个测试数据的场景时,会使用场景大纲。
数据表有助于将多个测试数据传递到场景中的单个步骤。您可以使用hashes
和rows
在步骤定义中访问此数据。
你可以在这里找到文档和例子。
在这里可以找到关于小黄瓜的更详细的文件。