我可以在specflow(或小黄瓜)中逃脱管道

vig*_*ity 31 cucumber specflow gherkin

我有一个specflow步骤表,我希望将|(管道)字符作为内容的一部分.

例:

Then the data should be
    | Field     | Value  |
    | SomeField | a|b|c  |
Run Code Online (Sandbox Code Playgroud)

但这不起作用.我怎样才能逃脱管道角色?

vig*_*ity 47

呸.我简直不敢相信我没有找到这个.您CAN逃避用反斜杠管道,但specflow语法高亮得到由它混淆.

Then the data should be
    | Field     | Value    |
    | SomeField | a\|b\|c  |
Run Code Online (Sandbox Code Playgroud)

  • 如果您正在使用SpecFlow,我强烈建议您使用SpecFlow Assist,它将框架映射到您的实体对象的https://github.com/techtalk/SpecFlow/wiki/SpecFlow-Assist-Helpers (2认同)