【问题标题】:Selenium Can't Find 'spec' FolderSelenium 找不到“规范”文件夹
【发布时间】:2011-03-09 22:56:31
【问题描述】:

因此,我正在尝试设置我的本地系统,以帮助完成仅使用 Rails 的雇主的现有项目。他们希望我主要专注于 rspec 测试,因为该项目几乎可以正常运行,我需要充实他们错过的东西。但是,我无法获得“rake spec”来构建我的测试文件夹。事实上,测试文件夹包含一些使用 Selenium 的基本用户登录测试(我没有编写它们)。这是错误的痕迹:

/opt/local/lib/ruby/gems/1.8/gems/selenium-client-1.2.18/lib/selenium/rspec/spec_helper.rb:2:in 'require': no such file to load -- spec (LoadError)
from /opt/local/lib/ruby/gems/1.8/gems/selenium-client-1.2.18/lib/selenium/rspec/spec_helper.rb:2
from /Users/cliffhess/ampms/spec/integration/user_registration_name_not_blank_spec.rb:5:in 'require'
from /Users/cliffhess/ampms/spec/integration/user_registration_name_not_blank_spec.rb:5
from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in 'load'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in 'load_spec_files'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in 'map'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in 'load_spec_files'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in 'run'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in 'run_in_process'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in 'run'
from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in 'autorun'
from /opt/local/lib/ruby/gems/1.8/bin/rspec:19
rake aborted!

事实上,我很确定我理解这个问题(也许?)。 selenium-clients 的 spec_helper.rb 中的第 2 行显示 require 'spec',如果我没记错的话,它是说 selenium-client 应该包含一个名为 spec 的文件夹,其中包含其所有 rspec 内容。 selenium-client 没有这个文件夹,所以我有点困惑它应该如何首先需要这个文件夹。如果我将行更改为require 'rspec',那么在这个虚构的规范文件夹中还有许多其他引用也会导致 rake 中止。

我正在运行 Ruby 1.8.7、Rails 3.0.3 和最新版本的 selenium。任何帮助都会令人惊叹,我已经在谷歌上搜索这个问题超过一天了,并且无法提出解决方案。

【问题讨论】:

    标签: ruby-on-rails ruby selenium rspec specifications


    【解决方案1】:

    我遇到了和你一样的问题,我尝试了一些方法让它可以运行,所以我只是从我的问题中复制我的答案 - LoadError when using Selenium: no such file to load -- spec


    首先我发现Cucumber + Webrat + Selenium guide 真的很有用

    其次,我删除了

    require "selenium/rspec/spec_helper"
    require "spec/test/unit"
    

    并添加了

    require 'spec_helper'
    

    其中spec_helper 包含在规范文件夹中

    我还删除了append_after的所有方法

    现在基本上可以运行测试用例了,这不是最好的解决方案,但这是我迄今为止所做的。

    P.S:需要从http://seleniumhq.org/download/下载Selenium服务器并用java -jar selenium-server-standalone-2.0b2.jar运行服务器

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多