- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我将 Cucumber 与 Ruby 结合使用。
我有一个 ParameterType它识别货币值并将它们解析为 BigDecimal,例如“鉴于成本是 25.50 美元”。
我想对表格做类似的事情,即任何匹配模式的东西都应该自动转换,例如:
Given these products:
| item | cost |
| foo | $10.50 |
| bar | $5.25 |
我无法在文档中找到任何关于此的信息。可能吗?
编辑:这似乎曾经被 Step Argument Transforms 支持但这些在 Cucumber 3 中被删除了:
A table transform is matched via a comma-delimited list of the column headers prefixed with 'table:'
最佳答案
在步骤定义中,确保遍历表中的所有项目并调用步骤Given the cost is XXX
这是步骤def中的示例逻辑
And(/^Given these products:$/) do |table|
# iterate through table
table.hashes.each do |product|
# you can get the product details here
item = product['item']
cost = product['cost']
# you can use the item if you want to select or any operation
# calling the Given the cost is xx step (here calling the step that already you implemented)
step("Given the cost is #{cost}")
end
end
关于cucumber - 将 ParameterType 与表数据一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55944335/
我的代码中有这个类 public abstract class MyAbstractEventListener { public abstract void handleEvent(E e);
我将 Cucumber 与 Ruby 结合使用。 我有一个 ParameterType它识别货币值并将它们解析为 BigDecimal,例如“鉴于成本是 25.50 美元”。 我想对表格做类似的事情,
我有以下代码片段(这只是指出我正在寻找解决方案的问题的示例): public class Test { public enum myEnum { myEnum1,
我正在编写一个自动化 SQLCLR 部署工具,并使用反射来发现必须声明的过程和函数。因此,我使用这样的代码来构建部署汇编方法所需的 T-SQL: ... if (p.ParameterType ==
我有以下代码- MyInterface.java - default int getNumber() { System.out.print("Number: ");
我正在尝试使用 ITK Python 绑定(bind)来执行此操作: mi_metric = itk.MutualInformationImageToImageMetric[itk.Image.F3,
我是一名优秀的程序员,十分优秀!