0

我正在尝试使用带有 ruby​​ 函数的 appian 的fitnesse 向文本字段输入一个值。我有一个黄瓜场景:

Feature:  create a quick decision

Scenario Outline: decision
       
  When I populate the "Decision Title" field with <decTitle>
 Examples:
  | role                  | decTitle                |
  | "test" | "testinput "user1" titlepart2"   | 

我必须能够在该字段中输入一个带引号的值以及从下拉菜单中进行选择。

我试图通过使用以下方法来转义引号:

  1. 同一行和多行上的三引号 """ foo "和" bar """

  2. " 用于开头和内部引号 "foo "and" bar" "foo "and" bar"

  3. "foo ""and"" bar" 内外双引号

运行测试用例时,所有结果都会导致相同的“步骤未定义”错误,我们将不胜感激。

4

1 回答 1

0

您可以使用正则表达式(.*)来传递带有双引号的值。如下图,

场景

  @Regression
  Scenario Outline: decision
    When I populate the "Decision Title" field with <decTitle>

    Examples: 
      | role   | decTitle                       |
      | "test" | "testinput "user1" titlepart2" |

代码

@When("I populate the \"(.*)\" field with (.*)$")
public void populate(String message, String decTitle) {
    System.out.println("Message: " + message);
    System.out.println("Title: " + decTitle);
}

输出

Message: Decision Title
Title: "testinput "user1" titlepart2"
于 2021-11-05T03:59:58.330 回答