【问题标题】:How to make cucumber read Scenario Outline Example values contain single quotes如何让黄瓜阅读场景大纲示例值包含单引号
【发布时间】:2019-11-25 22:57:58
【问题描述】:
......
And I will see the providerName <providerName> for Providerone
.......
Examples:
| providerName          | 
| 'St. Edward's School' |

上面的场景大纲生成了下面的测试存根。它描述了黄瓜考虑了单引号中的第一个值。如何在 cucumber 中声明示例语句,以便将整个值读取为 1 个字符串

When('I will see the providerName {string}s School\' for Providerone', function (string) {
    // Write code here that turns the phrase above into concrete actions
    return 'pending';

【问题讨论】:

  • 尝试使用双引号 - "St. Edward's School" 或转义单引号 - 'St. Edward\'s School'

标签: cucumber


【解决方案1】:

您需要在步骤中为提供者名称加上引号:

And I will see the providerName "<providerName>" for Providerone

那么示例表就不需要任何多余的引号了:

Examples:
| providerName        | 
| St. Edward's School |

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-18
    • 2020-07-11
    • 1970-01-01
    • 1970-01-01
    • 2019-12-15
    • 2018-07-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多