我是 calabash 的新手,我正在尝试运行测试,calabash 识别出我的第一步并通过了,但是对于第二步我遇到了一个未定义的方法错误,
我的特征文件是:
Feature: Sign-in page
Scenario: Go to dashboard with skip login
Given I am on the Login Screen
When I touch the “Skip Login” button
Then I should see the Main Screen
我的rb文件是
Given(/^I am on the Login Screen$/) do
element_exists("button marked:'authenticate'")
end
When(/^I touch the "Skip Login" button$/) do
tap_mark 'skip_login'
end
Then(/^I should see the Main Screen$/) do
wait_for_elements_exist("label text: 'HeaderText'")
end
当它到达“何时”步骤时,应用程序在我的手机上关闭。 有人可以帮我解决这个问题吗?
输出是:
Given I am on the Login Screen # features/step_definitions/calabash
_steps.rb:1 当我触摸“跳过登录”按钮时#features\my_first.feature:4 然后我应该看到主屏幕 # features/step_definitions/calabash _steps.rb:9
1 个场景(1 个未定义) 3 个步骤(1 个跳过,1 个未定义,1 个通过) 0m22.691s
您可以使用这些 fragment 为未定义的步骤实现步骤定义:
当(/^我触摸“跳过登录”按钮$/)时 pending # 用你希望的代码表达上面的正则表达式 结束
更详细一点,如果我采取第二步并移动它而不是第一步,它会按下按钮。我不明白为什么会这样,为什么它不会执行第二步
最佳答案
对我来说这看起来像是一个“智能引号”问题:
当我触摸“跳过登录”按钮时
那些不是常规的双引号 "
。
因为您没有在步骤定义中使用正则表达式,所以我建议这样做:
Given I am on the Login Screen
When I touch the Skip Login button
Then I should see the Main Screen
When(/^I touch the Skip Login button$/) do
tap_mark 'skip_login'
end
关于android - calabash-android 未定义的第二步方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30914754/