4

When running multiple features with the Ruby gem Parallel_Tests in cucumber using this command:

parallel_cucumber features/

with a cucumber.yml file under my project root>config folder, which looks like:

default: --format html --out report<%= ENV['TEST_ENV_NUMBER'] %>.html

I receive the following error message:

cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.

I have looked into this and some others have thought it was due to a rerun.txt file, but i have not created this file and a project file search returns nothing. I am currently at a loss of what is causing cucumber to fail reading in the yaml file. Any help would be great.

As described by another post, I went into lib/ cucumber/cli/profile_loader.rb and added a STDERR output like so:

begin
  @cucumber_yml = YAML::load(@cucumber_erb)
rescue StandardError => e
  STDERR.puts @cucumber_erb
  raise(YmlLoadError,"cucumber.yml was found, but could not be parsed.     Please refer to cucumber's documentation on correct profile usage.\n")
end

Here is the result:

#parallel_reports: --format html --out reports/cukes_.html 
cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.
#      

default: --format htm#l  
-   
oduetf aruelpto:r t-2-.fhotrmmla  #hptamrla l-l-eolu_tr erpeoprotrst:4 .-h-tfmolr a#tp ahrtamlll e-l-_oruetp orretpso:r t-s-/fcourkmeast_ .hhttmmll - ouctu cruempboerrt.sy/mclu kweass_ .fhotumnld, buctu ccuomubledr .nyomtl  bwea sp afrosuendd.,  Pblueta sceo urledf enro tt ob ec upcaurmsbeedr.' sP ldeoacsuem ernetfaetri otno  ocnu ccuomrbreerc'ts  pdroocfuimleen tu astaigoen. 
n correct profile usage.
Austin L
  • 336
  • 1
  • 17

4 Answers4

3

I stumbled upon this problem and only found solutions that suggested removing rerun.txt. That was not an option for me because I rely on that file to rerun failing scenarios.

For some reason Cucumber outputs failing scenarios separated by \n in rerun.txt which is not accepted by the default command found in cucumber.yml.

My solution was to change the first line of cucumber.yml to substitute \n with a space:

rerun = File.file?('rerun.txt') ? IO.read('rerun.txt').gsub(/\n/, ' ') : ""
Aaron
  • 145
  • 1
  • 6
  • I forgot to add the rerun flag(s) this time around and was manually copying the output from the tool to add to a rerun file and missed this detail for a later trial. Nice addition! – Pysis Jul 20 '18 at 14:56
0

I had the same issue with the tests of Rails-Cucumber itself. In my case, just running this line fixed the problem:

rm .cucumber.rerun

Caution, sometimes the rerun file can have a different name.

MonsieurDart
  • 6,005
  • 2
  • 43
  • 45
0

There is a suggestion to use gem update –system

  • 1
    If you decided to answer the question, feel free to explain it. Answer should be self-explanatory & full. – nattfodd Mar 09 '18 at 15:30
0

For me, the error

cucumber.yml was found, but could not be parsed with ERB

meant that I was running my tests from RubyMine, and had set my Features folder not to the root of my project, but to a subfolder in the project called features.

When I changed this to the root of my project, it worked out fine!

Brad Parks
  • 66,836
  • 64
  • 257
  • 336