我是黄瓜/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:1frankly_map视图视图:标记了"UIButtonLabel":"照片视图"可访问性标签失败,原因是:选择器无效*-[__NSArrayM objectAtIndex:]:索引0超出空数组的界限(RuntimeError)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/rub/1.8/timeout.rb:53:in timeout'
./features/step_definitions/navigation_steps.rb:1:in
/^I应该在Map屏幕上$/'features/navigation.feature:5:in"然后我应该在地图屏幕上"
如果我理解正确,并且你访问默认按钮,你应该有这样的:
Then /^I should be on the Map screen$/ do
check_element_exists "view view:'UIButton' marked:'Photo View'"
end
试着贴一张共生体的截图,干杯。