我是使用 cucumber/frank/ruby 的新手,并尝试按照此处的步骤进行操作http://blog.thepete.net/blog/2012/06/24/writing-your-first-frank-test/ 我正在尝试创建一个步骤定义。在本教程中,他们为您提供了编写步骤定义的代码。这是他们的示例步骤定义代码:
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
它给了我错误然后我应该在地图屏幕上# features/step_definitions/navigation_steps.rb:1 frankly_map view view: 'UIButtonLabel' mapped:'Photo View' accessibilityLabel failed because: invalid selector
* -[__NSArrayM objectAtIndex:]:空数组的索引 0 越界 (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
/^I 应该在地图屏幕上$ /' features/navigation.feature:5:in `那么我应该在地图屏幕上'