0

I am trying to input a value to a text field using fitnesse for appian with ruby functions. I have a cucumber scenario:

Feature:  create a quick decision

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

it is imperative that I am able to input a value with quotes in to this field as well as select from a dropdown menu.

I have tried to escape the quotes by using the following:

  1. triple quote on on same and multi line """ foo "and" bar """

  2. " for both the starting and inner quotes "foo "and" bar" "foo "and" bar"

  3. double quotes within and out side "foo ""and"" bar"

all result in the same "step is undefined" error when running the test case any and all help would be appreciated.

  • Do you want to remove double quotes? Like, from `"testinput "user1" titlepart2"` to `testinput user1 titlepart2` or `"testinput" user1 "titlepart2"` – Nandan A Nov 04 '21 at 02:25
  • no, the goal is to input a value containing quotes. My use case is such that a title can include quotes among other reserved or uncommon characters. – Jesse Barnett Nov 05 '21 at 03:14
  • Have you tried my soltion? – Nandan A Nov 08 '21 at 14:23

1 Answers1

0

You can use regular expression (.*) to pass the value with double quotes. Like below,

Scenario:

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

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

Code:

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

Output:

Message: Decision Title
Title: "testinput "user1" titlepart2"
Nandan A
  • 2,702
  • 1
  • 12
  • 23