2012-07-31 124 views
0

我是新來的黃瓜/弗蘭克/紅寶石工作,並試圖按照這裏的步驟http://blog.thepete.net/blog/2012/06/24/writing-your-first-frank-test/ 我想創建一個步驟的定義。在教程中,他們給你編寫你的步驟定義的代碼。這是他們對樣本步驟定義代碼:如何寫黃瓜測試frank

Then /^I should be on the Home screen$/ do 
    check_element_exists "view view:'UIImageView' marked:'Icon512x512.png'" 
end 
When /^I navigate to "(.*?)"$/ do |tab_name| 
    touch "view:'UITabBarButton' marked:'#{tab_name}'" 
end 
Then /^I should be on the Events screen$/ do 
    check_element_exists "view:'UIScrollView' view:'UIButton' marked:'archery'" 
    check_element_exists "view:'UIScrollView' view:'UIButton' marked:'badminton'" 
    check_element_exists "view:'UIScrollView' view:'UIButton' marked:'boxing'" 
end 

我試着寫只是第一部分適用於我的應用程序,這樣寫的:

Then /^I should be on the Map screen$/ do 
    check_element_exists "view view:'UIButtonLabel' marked:'Photo View'" 
end 

它給我的錯誤 然後我應該是地圖屏幕#功能/ step_definitions/navigation_steps.rb上:1個 frankly_map觀點看法: 'UIButtonLabel' 標明: '圖片瀏覽' accessibilityLabel失敗,因爲:無效的選擇 * - [__ NSArrayM objectAtIndex:]:索引0是yond bounds for empty array(RuntimeError) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:53:in timeout' ./features/step_definitions/navigation_steps.rb:1:in/^我應該在地圖屏幕上$ /「 功能/ navigation.feature:5:'那麼我應該在地圖畫面上」

回答

0

如果我理解正確的話,那你的訪問默認按鈕,你應該有這樣的:

Then /^I should be on the Map screen$/ do 
    check_element_exists "view view:'UIButton' marked:'Photo View'" 
end 

嘗試發佈您的symbiote的屏幕截圖,以及歡呼聲。