简体   繁体   English

如何在Java中的黄瓜中捕获多行文本

[英]How to capture multiple line text in cucumber in Java

I have a Java cucumber test which has the following test case: 我有一个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
  """

The step def I wrote is: 我写的步骤def是:

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

This does not work and the multiple line text is not captured. 这不起作用,也不会捕获多行文本。 How can I write a working step definition for this? 如何为此编写工作步骤定义?

Just use this - @Then("^the returned information should be$") . 只需使用它- @Then("^the returned information should be$") Add a String parameter to the method. String参数添加到该方法。 The multi line text will be automatically injected into the parameter. 多行文本将自动注入到参数中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM