我在这里关注rails教程:http://railstutorial.org/chapters/filling-in-the-layout#top
当我运行"rspec spec /"时,我得到一堆看起来像这样的错误:
1) LayoutLinks should have a Home page at '/'
Failure/Error: Unable to find matching line from backtrace
stack level too deep
# C:/Ruby19/lib/ruby/1.9.1/forwardable.rb:185
2) LayoutLinks should have a Contact page at '/contact'
Failure/Error: Unable to find matching line from backtrace
stack level too deep
# C:/Ruby19/lib/ruby/1.9.1/forwardable.rb:185
Run Code Online (Sandbox Code Playgroud)
但是当我在我的网络浏览器中访问localhost:3000 /和localhost:3000/contact时,页面就在那里,并且有正确的标题.这是我的myrailsroot\spec\requests\layout_links_spec.rb文件:
require 'spec_helper'
describe "LayoutLinks" do
it "should have a Home page at '/'" do
get '/'
response.should have_selector('title', :content => "Home")
end
it "should have …Run Code Online (Sandbox Code Playgroud) 有没有人有任何具体的理由使用一个autotesting跑步者而不是另一个?我已经使用了Autofeature + autotest,我真的很喜欢它设置的内置过程,它首先运行我的rspec单元测试,然后是黄瓜测试,只有最后一次失败测试 - 它适合标准编写黄瓜测试的工作流程,设置步骤直到它们失败,然后进入单元测试以获得详细功能.
我在标准的rspec配置中使用了Guard,它也运行良好,但我没有在黄瓜测试中折叠 - 没有时间进一步实验.
只是想知道是否有人有任何具体的理由使用一个在另一个,或一种方式减轻另一方的弱点.
谢谢你的意见,Tony
我正在使用黄瓜,rails3,rspec2和自动测试.我试图找出为什么我的功能无限循环.我怀疑在测试过程中有些文件正在被更改,但我不确定是哪一个.我添加了一些例外.autotest,没有骰子.
我可以采取任何措施来解决此问题吗?
如果我能看到哪些文件正在触发重新运行,或者在运行时看到正在观看/未观看的文件,那就太酷了.
这是我的.autotest内容
require 'autotest/growl'
Autotest::Growl::clear_terminal = false
# Skip some paths
Autotest.add_hook :initialize do |autotest|
%w{.git .DS_store db log tmp rerun.txt}.each { |e| autotest.add_exception(e) }
end
Run Code Online (Sandbox Code Playgroud) 自动测试通过仅运行更改的测试来提高测试运行的速度.
但我想通过使用spork预加载Rails环境来进一步推动它,这样我将获得更快的反馈.
这可能吗?
自动测试:https://github.com/grosser/autotest
Spork:http://github.com/timcharper/spork
我用ZenTest和自动测试之前对Ruby项目工作,我曾经使用他们的测试驱动开发一拉此配置.我有一个项目,我目前正在使用Java,我想知道Java世界中是否有类似的东西可以实现相同的效果.
我想知道clojure存在哪些自动测试工具.在Ruby中,我有ZenTest,redgreeen等不断继续测试我的代码.我想为Clojure做类似的事情
到目前为止,我在github上找到了这个简单的脚本https://github.com/devn/clojure-autotest.对我来说有点粗糙.所有测试都在发生变化时运行.此外,它可能会在语法错误的情况下脱口而出一个长堆栈跟踪,从而掩盖了出错的地方.
这是我的宝石文件
source 'http://rubygems.org'
gem 'rails', '3.0.9'
gem 'mysql2', '~> 0.2.6'
group :development do
gem 'rspec-rails'
end
group :test do
gem 'rspec'
end
Run Code Online (Sandbox Code Playgroud)
相当简单,没什么不寻常的.在通过测试时,自动测试工作得很好,并且应该停止
Finished in 0.1158 seconds
4 examples, 0 failures
/Users/alex/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -rrubygems -S /Users/alex/.rvm/gems/ruby-1.9.2-p180@rails3/gems/rspec-core-2.6.4/bin/rspec --tty '/Users/alex/Sites/slacklog/spec/controllers/pages_controller_spec.rb'
Run Code Online (Sandbox Code Playgroud)
但是当测试失败时,它会无休止地循环失败
Failures:
1) PagesController GET 'contact' Should have the proper title for the contact page
Failure/Error: response.should have_selector( "contact",
expected following output to contain a <contact>Contact us</contact> tag:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Slacklog</title>
<script src="/javascripts/jquery.js" type="text/javascript"></script><script src="/javascripts/jquery_ujs.js" type="text/javascript"></script><script src="/javascripts/application.js?1309037322" …Run Code Online (Sandbox Code Playgroud) 我刚刚安装了Zentest 4.4.6,其中包括autotest 4.4.6,当我运行自动测试时,我收到以下错误:
gems/ZenTest-4.6.0/lib/autotest.rb:226:in `autodiscover': undefined method `any?' for Gem::Specification:Class (NoMethodError)
Run Code Online (Sandbox Code Playgroud)
是吧?就像它没有铁轨就恢复了红宝石
我对RoR完全不熟悉.我正在关注Michael Hartl的书.我无法进行自动测试.请建议出现问题的原因和解决方法.
当我在Rails项目目录中的命令行运行'autotest'时,我得到以下信息:
-bash: autotest: command not found
Run Code Online (Sandbox Code Playgroud)
当我运行'bundle exec autotest'时,我得到以下信息:
bundler: command not found: autotest
Install missing gem binaries with `bundle install'
Run Code Online (Sandbox Code Playgroud)
这是Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development do
gem 'autotest'
gem 'rspec-rails', '2.4.1'
end
group :test do
gem 'rspec', '2.4.0'
gem 'webrat', '0.7.1'
end
Run Code Online (Sandbox Code Playgroud)
这是'宝石列表'的输出
abstract (1.0.0)
actionmailer (3.0.7, 3.0.6, 3.0.3, 2.3.5, 1.3.6)
actionpack (3.0.7, 3.0.6, 3.0.3, 2.3.5, 1.13.6)
actionwebservice (1.2.6)
activeresource (3.0.7, 3.0.6, 3.0.3, 2.3.5)
activesupport (3.0.7, 3.0.6, 3.0.3, 2.3.5, …Run Code Online (Sandbox Code Playgroud) 我对自动测试如何工作的印象(基于黄瓜github wiki和其他在线内容)是它应该重新运行红色示例,直到它们通过.我的问题是它重新运行spec文件中找到失败示例的所有示例,包括传递的示例.在修复失败的例子时,我宁愿不浪费时间重新运行示例.是否可以配置自动测试,以便只运行失败的示例?