在黄瓜步骤定义中转义字符

时间:2014-05-12 17:57:51

标签: escaping cucumber bdd gherkin cucumber-java

我在Cucumber-jvm使用了以下步骤。如何在步骤定义中转义某些字符?

When user verifies if ABC widget exists
Then the 'The 7 Things $channel' label is displayed

在这种情况下,我需要将 7 $ 作为常规字符串转义。

1 个答案:

答案 0 :(得分:3)

你可以这样做,

Then the /'The 7 Things $channel' label is displayed/

相应的步骤def将是,

 @Then("^the /'The 7 Things \\$channel' label is displayed/$")
   public void the_The_Things_$channel_label_is_displayed() throws Throwable {
      System.out.println("hello");
   }