[英]RegEx for text with double quotes in Calabash
我在auth.feature文件中有一個場景:
Scenario: Authorize
Given I am on the Main View
When I touch the "ServiceButton" button
以及在auth_steps.rb文件中觸摸的步驟:
When(/^I touch the "([^\"]*)" button$/) do |button|
touch("button marked:'#{button}'")
sleep(STEP_PAUSE)
end
當我嘗試使用它時,我有一個錯誤:
You can implement step definitions for undefined steps with these snippets:
When(/^I touch the “ServiceButton” button$/) do
pending # express the regexp above with the code you wish you had
end
我使用了幾個正則表達式,但沒有任何工作。 我找到的唯一解決方案是
When(/^I touch the (.*) button$/) do |button|
但在這種情況下,我需要編寫沒有引號的按鈕名稱,這不是我想要的。
這就是我使用的:Xamarin,iPhone SDK 6.1,calabash-iOs。 要使用cucumber NO_LAUNCH=1
測試我的應用程序,我通過Xamarin啟動應用程序,然后輸入控制台cucumber NO_LAUNCH=1
。
如果有人能幫助我解決這個問題,我將非常感激。
將步驟定義更改為:
When(/^I touch the “([^\"]*)“ button$/) do |button|
touch("button marked:'#{button}'")
sleep(STEP_PAUSE)
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.