Cucumber high-level step definition - syntax error, unexpected tIDENTIFIER, expecting keyword_end(Cucumber 高级步骤定义 - 语法错误,意外 tIDENTIFIER,期望关键字_end)
问题描述
我已遵循 重用 Cucumber 步骤.
说到 Ruby 和 Cucumber,我是个菜鸟.
我正在使用 calabash-android 0.9.0 和 cucumber 2.4.0
I'm a noob when it comes to Ruby and Cucumber.
I'm using calabash-android 0.9.0 and cucumber 2.4.0
我的calabash_steps.rb:
My calabash_steps.rb:
require 'calabash-android/calabash_steps'
Then /^I add the 1st bestsellers product to bag$/ do
steps %Q {
# App restarts and Onboarding screen shows again
Given I see the text "next"
Then I press the "next" button
}
end
完整的堆栈跟踪:
❯ bundle exec calabash-android run app/build/outputs/apk/app-staging-debug.apk -t @bag
/Users/eric/AndroidStudioProjects/xxx/features/step_definitions/calabash_steps.rb:7: syntax error, unexpected tIDENTIFIER, expecting keyword_end
Then I press the "next" button
^ (SyntaxError)
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in `load'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in `load_code_file'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:142:in `load_file'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:84:in `block in load_files!'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in `each'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in `load_files!'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:253:in `load_step_definitions'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:61:in `run!'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/cli/main.rb:32:in `execute!'
/Users/eric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/bin/cucumber:8:in `<top (required)>'
/Users/eric/.rbenv/versions/2.4.0/bin/cucumber:22:in `load'
/Users/eric/.rbenv/versions/2.4.0/bin/cucumber:22:in `<main>'
推荐答案
问题是steps %Q {
中多余的空间,改成steps %Q{
解决了问题
我有滥用空格字符以提高 Java 和 Javascript 可读性的习惯
The problem was the extra space in steps %Q {
, changing it to steps %Q{
made the problem go away
I have the habit of abusing space characters for readability in Java and Javascript
需要'calabash-android/calabash_steps'
require 'calabash-android/calabash_steps'
Then /^I add the 1st bestsellers product to bag$/ do
steps %Q{
# App restarts and Onboarding screen shows again
Given I see the text "next"
Then I press the "next" button
}
end
这篇关于Cucumber 高级步骤定义 - 语法错误,意外 tIDENTIFIER,期望关键字_end的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Cucumber 高级步骤定义 - 语法错误,意外 tIDENTIFIER,期望关键字_end


- android 4中的android RadioButton问题 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01