如何在 Java 中捕获黄瓜中的多行文本
How to capture multiple line text in cucumber in Java
我有一个 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 (.*)$")
这不起作用,多行文本未被捕获。我如何为此编写工作步骤定义?
只需使用这个 - @Then("^the returned information should be$")
。向该方法添加一个 String
参数。多行文本将自动注入到参数中。
@Then("^the returned information should be$")
public void blahblah(String multi) {}
我有一个 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 (.*)$")
这不起作用,多行文本未被捕获。我如何为此编写工作步骤定义?
只需使用这个 - @Then("^the returned information should be$")
。向该方法添加一个 String
参数。多行文本将自动注入到参数中。
@Then("^the returned information should be$")
public void blahblah(String multi) {}