简体   繁体   English

Ruby / Cucumber错误:步骤定义必须始终具有proc或符号

[英]Ruby/Cucumber Error: Step definitions must always have a proc or symbol

My automation test suite for an application is written using Ruby/Cucumber. 我的应用程序自动化测试套件是使用Ruby / Cucumber编写的。 When I try to run the tests using the cucumber command, and I receive the following error: Step definitions must always have a proc or symbol . 当我尝试使用cucumber命令运行测试时,收到以下错误: Step definitions must always have a proc or symbol I can't find any references to this error online except for the source code itself. 除了源代码本身之外,我网上找不到对该错误的任何引用。

Full stack trace: 完整堆栈跟踪:

Step definitions must always have a proc or symbol (Cucumber::Glue::StepDefinition::MissingProc)
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/step_definition.rb:29:in `new'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/registry_and_more.rb:83:in `register_rb_step_definition'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/dsl.rb:31:in `register_rb_step_definition'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/dsl.rb:133:in `register_rb_step_definition'
C:/Users/westoa1/dev/eclipse-workspace/rms-quality-manager/cucumber/features/step_definitions/data_steps.rb:75:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/registry_and_more.rb:107:in `load'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/registry_and_more.rb:107:in `load_code_file'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:144:in `load_file'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:85:in `block in load_files!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:84:in `each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:84:in `load_files!' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:272:in `load_step_definitions'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:68:in `run!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in `execute!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/bin/cucumber:9:in `<top (required)>'
C:/Ruby25-x64/bin/cucumber:23:in `load'
C:/Ruby25-x64/bin/cucumber:23:in `<main>'

I searched through my step definition files and found an incomplete step definition with no block: 我搜索了步骤定义文件,发现没有块的不完整步骤定义:

Given 'There is a user'

The block was removed while resolving merge conflicts, and completing the step definition solved the error: 解决合并冲突时删除了该块,并完成了步骤定义,从而解决了该错误:

Given 'There is a user' do 
    (do stuff)
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM