3

我可以清楚地看到浏览器中的文字。

characters should be "R", "P", or "B".

但是当我写一个步骤时,一个黄瓜步骤

Then I should see "characters should be \"R\", \"P\", or \"B\"."

它说它

Undefined step: "I should see "characters should be \"R\", \"P\", or \"B\"."" (Cucumber::Undefined)

并说将步骤定义为

Then /^I should see "([^"]*)"R\\"([^"]*)"P\\"([^"]*)"B\\"([^"]*)"$/ do |arg1, arg2, arg3, arg4|
    pending # express the regexp above with the code you wish you had
end

为什么黄瓜不认识这一步?

还是引号内引号的转义问题?

谢谢

4

1 回答 1

0

Pystring 可能会起作用。使用三个双引号将整行表示为字符串。

黄瓜步

Then I should see
"""
characters should be "R", "P", or "B".
"""

步骤定义

Then /^I should see "([^"]*)"$/ do |string|
  pending # express the regexp above with the code you wish you had
end
于 2012-07-17T01:50:41.743 回答