0
votes

I run a test and randomly I'll get the error: can't modify frozen String (RuntimeError)

This error seems to occur only after a timeout error has happened. Not sure if that means that they are related but it leads me to believe so. Anyone have any ideas what is causing this? It only seems to happen when running in the command prompt (least I haven't yet seen it through Rubymine).

Edit: Windows 7 64 bit

Ruby 1.9.3 Here's the gems I'm using:

LOCAL GEMS

  • activemodel (3.1.3)
  • activerecord (3.1.3)
  • activerecord-sqlserver-adapter (3.1.5)
  • activesupport (3.1.3)
  • arel (2.2.1)
  • bigdecimal (1.1.0)
  • builder (3.0.0)
  • bundler (1.0.21)
  • childprocess (0.3.0)
  • composite_primary_keys (4.1.2)
  • cucumber (1.1.4)
  • database_cleaner (0.7.1)
  • diff-lcs (1.1.3)
  • factory_girl (2.5.0, 2.4.2)
  • faker (1.0.1)
  • ffi (1.0.11, 1.0.9 x86-mingw32)
  • gherkin (2.7.6 x86-mingw32, 2.7.3 x86-mingw32)
  • i18n (0.6.0)
  • iemodal (0.0.4)
  • io-console (0.3)
  • json (1.6.5, 1.5.4)
  • minitest (2.5.1)
  • multi_json (1.0.4)
  • page-object (0.6.1)
  • pickle (0.4.10)
  • rake (0.9.2.2)
  • rdoc (3.9.4)
  • require_all (1.2.1)
  • rspec (2.8.0)
  • rspec-core (2.8.0)
  • rspec-expectations (2.8.0)
  • rspec-mocks (2.8.0)
  • ruby-odbc (0.99994)
  • rubygems-update (1.8.15)
  • rubyzip (0.9.5)
  • selenium-webdriver (2.17.0)
  • term-ansicolor (1.0.7)
  • test-unit (2.4.5)
  • tzinfo (0.3.31)
  • watir-webdriver (0.5.0, 0.4.1)
  • yard (0.7.4)

Here's the stack-trace:

can't modify frozen String (RuntimeError)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/formatter/html.r
b:383:in `block in build_exception_detail'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:155:in
`call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:155:in
`_nested_structures'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:63:in `
method_missing'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/formatter/html.r
b:373:in `build_exception_detail'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/formatter/html.r
b:269:in `exception'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:173:in `block in send_to_all'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:171:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:171:in `send_to_all'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:166:in `broadcast'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:122:in `visit_exception'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/scenario.rb:
68:in `fail!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/language_support
/language_methods.rb:117:in `rescue in invoke'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/language_support
/language_methods.rb:113:in `invoke'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/language_support
/language_methods.rb:102:in `block in execute_before'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/language_support
/language_methods.rb:101:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/language_support
/language_methods.rb:101:in `execute_before'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/language_support
/language_methods.rb:15:in `before'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/runtime/support_
code.rb:112:in `block in fire_hook'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/runtime/support_
code.rb:111:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/runtime/support_
code.rb:111:in `fire_hook'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/runtime.rb:104:i
n `before'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/background.r
b:39:in `block in accept'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/background.r
b:52:in `block in with_visitor'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/scenario.rb:
108:in `with_visitor'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/background.r
b:51:in `with_visitor'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/background.r
b:38:in `accept'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:57:in `block in visit_background'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:163:in `broadcast'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:56:in `visit_background'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/feature.rb:4
1:in `accept'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:20:in `block in visit_feature'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:163:in `broadcast'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:19:in `visit_feature'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/features.rb:
29:in `block in accept'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/features.rb:
17:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/features.rb:
17:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/features.rb:
28:in `accept'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:14:in `block in visit_features'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:163:in `broadcast'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/ast/tree_walker.
rb:13:in `visit_features'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/runtime.rb:46:in
 `run!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/cli/main.rb:43:i
n `execute!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/cli/main.rb:20:i
n `execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/bin/cucumber:14:in `<top (req
uired)>'
C:/Ruby193/bin/cucumber:19:in `load'
C:/Ruby193/bin/cucumber:19:in `<main>'

Edit 2: Ok I've tracked it down and it appears there's an issue deep down within the @browser = Watir::Browser.new :ie command that I have in my hooks begin block... Not sure what's going on here but thought I'd update with where I stand atm.

2
Can you give some relevant detail? Where is this occurring? What library? What version? This question can not be answered in this form. - Linuxios
@Linux_iOS.rb.cpp.c.lisp.m.sh Yup sorry. Just added in the data that should help... let me know if you need more. - Major
Wow. I think that this is a bug in cucumber. File a bug report. I don't think anyone here can help you. Sorry. - Linuxios
Try editing C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.4/lib/cucumber/formatter/html.rb:374 to read message = exception.message.dup - that could possibly unmask the real error. - jarib
@jarib I'm running the tests again with your change and so far so good... Not sure if that's a good thing but I'll see if I can get the error to reproduce with that change. If not I'll see if I can get it to reproduce with the original code. I'll let you guys know one way or the other. - Major

2 Answers

0
votes

Try perhaps moving the creation of the instance of the @browser to the env.rb file (in features/support )

If you always need the @browser object then starting it up there might be simpler than dealing with hooks.

0
votes

If you are using a hash to make testing easier, or have a hash where you're calling gsub! on the keys in the hash, that could be causing the error. Not sure if this is happening at all in your current problem.

I came across the same error, but different situation. See Why is a string key for a hash frozen? for more detail.