Reputation: 1119
I am struggling to set-up watir-rspec framework for my web-project for ui-testing. (https://github.com/watir/watir-rspec)
Here are the steps I took:
Here is the error I am getting:
C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-rspec-1.1.0/lib/watir/rspec/helper.rb:4:in `<module:Helper>': uninitialized constant Watir::RSpec::Helper::Forwardable (NameError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-rspec-1.1.0/lib/watir/rspec/helper.rb:3:in `<class:RSpec>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-rspec-1.1.0/lib/watir/rspec/helper.rb:2:in `<module:Watir>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-rspec-1.1.0/lib/watir/rspec/helper.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-rspec-1.1.0/lib/watir/rspec.rb:47:in `<top (required)>'
from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
from C:/wamp/www/smart/tests/ui-test/spec/spec_helper.rb:3:in `<top (required)>'
from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from C:/wamp/www/smart/tests/ui-test/spec/example_spec.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in `run'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'
What steps am I missing? Am I even trying to run the test correctly?
Obviously I am kindof new to this whole thing - any help would be appreciated.
Upvotes: 1
Views: 454
Reputation: 46836
The exception you are seeing appears to be watir/rspec doing a extend Forwardable
with the assumption that Forwardable had already been required. Adding a require 'forwardable'
will solve this problem.
Once that was fixed, I got unintialized constant Watir::Browser exceptions. It appears that watir/rspec does not automatically require watir for you. You need to manually do that, hence the adding of the require 'watir'
line.
In summary, following the steps you did, I found I had to make 2 changes to the spec_helper.rb. At the top of the file (ie before the require watir/rspec
line) add the lines:
require 'forwardable'
require 'watir'
Upvotes: 1