Cucumber 步骤定义中的转义字符 [英] Escape characters in Cucumber step definition
本文介绍了Cucumber 步骤定义中的转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下用于 Cucumber-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/
相应的 Step def 将是,
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");
}
这篇关于Cucumber 步骤定义中的转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文