无法修改冻结字符串错误

时间:2012-01-31 14:09:31

标签: ruby cucumber runtime-error watir-webdriver rubymine

我运行测试并随机发生错误:无法修改冻结的字符串(RuntimeError)

此错误似乎仅在发生超时错误后才会发生。不确定这是否意味着它们是相关的,但它让我相信。有人有什么想法导致这个?它似乎只在命令提示符下运行时发生(至少我还没有通过Rubymine看到它)。

编辑: Windows 7 64位

Ruby 1.9.3这是我正在使用的宝石:

本地宝石

  • 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)
  • 黄瓜(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)
  • 小黄瓜(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)
  • ruby​​gems-update(1.8.15)
  • ruby​​zip(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)
  • 码(0.7.4)

这是堆栈跟踪:

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>'

编辑2: 好的我已经跟踪了它,看起来在@browser = Watir :: Browser.new内部存在一个问题:即我在我的钩子中的命令开始阻止...不知道这里发生了什么但是我想d更新我站在哪里。

2 个答案:

答案 0 :(得分:0)

尝试将@browser实例的创建移动到env.rb文件(在features / support中)

如果你总是需要@browser对象然后启动它可能比处理钩子更简单。

答案 1 :(得分:0)

如果您使用哈希来简化测试,或者在您调用gsub时使用哈希值!在散列中的键上,可能导致错误。不确定你当前的问题是否会发生这种情况。

我遇到了同样的错误,但情况不同。有关详细信息,请参阅Why is a string key for a hash frozen?