Escape characters in Cucumber step definition

落花浮王杯 提交于 2019-12-01 05:42:00

问题


I have following steps that I am using for Cucumber-jvm. How do I escape certain characters in my step definitions?

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

In this case I need to escape 7 and $ as a regular string.


回答1:


You could do this,

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

Corresponding Step def would be,

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


来源:https://stackoverflow.com/questions/23615714/escape-characters-in-cucumber-step-definition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!