use*_*605 6 regex cucumber cucumber-jvm cucumber-junit
对于我正在尝试编写的行为测试,我需要浮点输入.如何设置我的小黄瓜字符串以查找这些值?
简单(.+)应该工作
Given I have a floating point 1.2345 number
@Given("^I have a floating point (.+) number$")
public void I_have_a_floating_point_number(double arg) throws Throwable {
...
}
Run Code Online (Sandbox Code Playgroud)
我自己的偏好是在点的两侧指定数字,例如......
@Given("^the floating point value of (\\d+.\\d+)$")
public void theFloatingPointValueOf(double arg) {
// assert something
}
Run Code Online (Sandbox Code Playgroud)
当你提到浮点输入复数时,我可能会处理多个输入,其轮廓如...
Scenario Outline: handling lots of floating point inputs
Given the floating point value of <floatingPoint>
When something happens
Then some outcome
Examples:
| floatingPoint |
| 2.0 |
| 2.4 |
| 5.8 |
| 3.2 |
Run Code Online (Sandbox Code Playgroud)
它将为每个浮点输入运行一个场景
| 归档时间: |
|
| 查看次数: |
9192 次 |
| 最近记录: |