黄瓜场景大纲中的换行符导致错误
Newline character in cucumber scenario outline causing error
在此处使用场景大纲处理 Cucumber 功能,其中一个值具有换行符,如下所示:
Scenario Outline: Good stuff here
Given I do some stuff
Then I should see "<text>"
Examples:
| text |
| text with a\nnewline character |
如果我 运行 这个我得到错误 765: unexpected token at text with a
。如果我 运行 它带有换行符并且在它之后没有像 text with a\n
这样的东西它不会抛出错误但是为了完整性我希望能够检查完整的字符串。这是 Cucumber 方案的限制还是有变通办法?
如评论中所述 - 使用 \n
而不仅仅是 \n
可以使它起作用,尽管通过阅读 cucumber/gherkin 文档我猜这实际上是一个错误cucumber/gherkin 因此在未来的版本中可能会中断。
在此处使用场景大纲处理 Cucumber 功能,其中一个值具有换行符,如下所示:
Scenario Outline: Good stuff here
Given I do some stuff
Then I should see "<text>"
Examples:
| text |
| text with a\nnewline character |
如果我 运行 这个我得到错误 765: unexpected token at text with a
。如果我 运行 它带有换行符并且在它之后没有像 text with a\n
这样的东西它不会抛出错误但是为了完整性我希望能够检查完整的字符串。这是 Cucumber 方案的限制还是有变通办法?
如评论中所述 - 使用 \n
而不仅仅是 \n
可以使它起作用,尽管通过阅读 cucumber/gherkin 文档我猜这实际上是一个错误cucumber/gherkin 因此在未来的版本中可能会中断。