执行Scenario Outline后,我收到以下消息,并且方案失败。
示例:
| ID | mail |
| Abc | test1@mail.com |
undefined method `file_colon_line' for #<Cucumber::Ast::OutlineTable::ExampleRow:0xbe09a88> (NoMethodError)
| ABC | test2@mail.com |
undefined method `file_colon_line' for #<Cucumber::Ast::OutlineTable::ExampleRow:0xbe09a60> (NoMethodError)
一些解决方案?
答案 0 :(得分:0)
我在features/support/capybara_screenshot.rb
中配置了custom screenshot filename,其中包含:
require 'capybara-screenshot'
require 'capybara-screenshot/cucumber'
Capybara.save_and_open_page_path = File.join(Integrator.root, 'tmp', 'failures')
Capybara::Screenshot.register_filename_prefix_formatter(:cucumber) do |scenario|
# only works with Cucumber 1
path = scenario.file_colon_line
# also works with Cucumber 2
path = scenario.location.to_s
# ...
end
scenario
曾经是黄瓜1的Cucumber::Ast::Background
类scenario
,其中file_colon_line已定义。
但Cucumber::Core::Test::Case
现在为黄瓜2返回file
,而黄瓜2则不再有file_colon_line
或location
。但它有location.file
,location.line
,location.to_s
,clear()
。