【问题标题】:How to capture multiple line text in cucumber in Java如何在 Java 中捕获黄瓜中的多行文本
【发布时间】:2019-09-03 00:35:34
【问题描述】:

我有一个 Java 黄瓜测试,它有以下测试用例:

.....
And the returned information should be
  """
  This is the first line of my text
  This is the second line of my text
  This is the third line of my text
  """

我写的步骤def是:

@Then("^the returned information should be (.*)$")

这不起作用,并且不会捕获多行文本。我该如何为此编写工作步骤定义?

【问题讨论】:

    标签: java cucumber


    【解决方案1】:

    只需使用这个 - @Then("^the returned information should be$")。在方法中添加String 参数。多行文本将自动注入参数中。

    @Then("^the returned information should be$")
    public void blahblah(String multi) {}
    

    【讨论】:

    • 我必须删除 $ 才能完成这项工作。例如:@Then("^the returned information should be")
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多