我有一个 Java cucumber 测试,其中包含以下测试用例:
.....
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 (.*)$")
这不起作用,并且不会捕获多行文本。我如何为此编写工作步骤定义?
最佳答案
只需使用这个 - @Then("^返回的信息应该是$")
。向该方法添加一个String
参数。多行文本将自动注入(inject)到参数中。
@Then("^the returned information should be$")
public void blahblah(String multi) {}
关于java - 如何在Java中捕获cucumber中的多行文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57760023/