Gherkin:带有双引号元素的字符串的步骤定义

Gherkin: Step definition with string which has double quoted element

我有步骤:

Then I should see validation error "Some text"

我在步骤定义中将此字符串用于 XPATH。 我也有这样的错误文本:

"Some "text""

我试着写这样的东西:

Then I should see validation error "Some \"text\""

但这没有帮助。 我该如何处理?

小黄瓜文件:

@blog 
Feature: test for Whosebug 

    Scenario Outline: Function to validate Whosebug.
    
    Then I should see validation error "Some text"

Java 实现(旧版本):

@Then("I should see validation error \"(.*)\"")
public void sof(String someText) {
    System.out.println("Your text is: " + someText);
}

Java 实施:

@Then("I should see validation error {string}")
public void sof(String someText) {
    System.out.println("Your text is: " + someText);
}

控制台:

Your text is: Some text