2014-05-12 46 views
2

我对Cucumber-jvm(Java语言的Cucumber实现)使用了以下步骤。我可以在我的步骤定义中转义特殊字符吗?如何在Cucumber步骤中定义特殊字符?

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

在这种情况下,我需要逃避7和$作为一个普通的字符串。

+0

为什么你认为你需要躲避数字吗? –

+0

@DaveSchweisguth 7或其他任何数字在我的步骤中都没有数字上下文值。这只是一个需要验证的文本标签。 – nabsATX

+0

你的意思是你想把“7”和“$ channel”作为步骤的参数吗? –

回答

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"); 
    } 
相关问题