本文介绍了黄瓜步骤定义中的转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下步骤用于黄瓜jvm .如何在步骤定义中转义某些字符?
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
在这种情况下,我需要转义 7 和 $ 作为常规字符串.
In this case I need to escape 7 and $ as a regular string.
推荐答案
您可以这样做,
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");
}
这篇关于黄瓜步骤定义中的转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!