英文:
Trying to Convert a cucumber DataTable as a string of array/list in Typescript
问题
我想在TypeScript中将Cucumber中的数据表用作列表。
// 当用户选择以下步骤时
const steps = [
["a"],
["b"],
["c"]
];
// 如果问题已经回答,请分享指引
TIA
英文:
I want to utilise the data table in cucumber as list in Typescript
<!-- language: lang-css -->
When user select these
|Steps|
|a|
|b|
|c|
<!-- end snippet -->
I want the steps to be utilised something like
const steps = dataTable.asLists(String.class)
If question already answered, please share pointers
TIA
答案1
得分: 0
这是我在TypeScript中实现Cucumber数据表的列表/数组的方式。
var steps = [];
for (let i = 0; i < dataTable.rows().length; i++) {
steps.push(dataTable.rows()[i][0]);
}
英文:
This is how I have achieved list/array in typescript from the cucumber datatable
<!-- language: lang-js -->
var steps = [];
for (let i = 0; i < dataTable.rows().length; i++) {
steps.push(dataTable.rows()[i][0]);
}
<!-- end snippet -->
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论