当我在 Java 测试中使用 Cucumber 时,JSON 字符串作为输入似乎有问题,例如
Scenario Outline: not work
Given anythin
When I use <body> as body to call <url>
Then I'll get a status code of <status>
Examples:
| body | url | status |
| {"id":5}| /rest/update/0 | 404 |
错误显示:
You can implement missing steps with the snippets below:
@When("^I use {\"([^\"]*)\":(\\d+)} as body to call \"([^\"]*)\"$")
public void i_use_as_body_to_call(String arg1, int arg2, String arg3) throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
但实际上,整个 JSON 字符串不应该被拆分。