简体   繁体   English

Rails2.3.8 上的 Ruby:如何使用开发环境运行测试?

[英]Ruby on Rails2.3.8: How do I run a test using the dev environment?

My test env is doing something that doesn't happen in dev.我的测试环境正在做一些在开发中不会发生的事情。 So, if I could run the tests in the dev env, then that would meat that there is something wrong with my tests (if they still fail), or the test env is broke (if they don't fail)所以,如果我可以在开发环境中运行测试,那么我的测试有问题(如果它们仍然失败),或者测试环境坏了(如果它们没有失败)

currently, I'm running single functional tests by doing目前,我正在运行单个功能测试

ruby /path/to/test_controller_test.rb

If you're running individual tests, there's nothing to stop you from taking a snapshot of your development database and loading it in to the test database.如果您正在运行单个测试,则没有什么可以阻止您拍摄development数据库的快照并将其加载到test数据库中。 If you run rake test then that will get cleared out, so keep that in mind.如果您运行rake test ,那么它将被清除,因此请记住这一点。

You may have tests that depend on records that don't exist, usually the result of making unsafe assumptions, or methods that don't work properly when certain things have not been built correctly.您的测试可能依赖于不存在的记录,通常是做出不安全假设的结果,或者在某些事情没有正确构建时无法正常工作的方法。 It is rare to find that the settings in config/environments have any direct effect on the tests themselves.很少发现config/environments中的设置对测试本身有任何直接影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Ruby on Rails2.3.8:单元测试:Rails / Ruby已设置为在每次测试之前运行。 在所有测试之前运行的方法呢? - Ruby on Rails2.3.8: Unit Testing: Rails/Ruby has setup to run before each test. What about a method that runs before all tests? 如何在Ruby on Rails 2.3.8中获得选定的值? - How do I obtain a selected value in Ruby on Rails 2.3.8? Ruby on Rails:2.3.8:如何使searchlogic与bundler一起使用? - Ruby on Rails: 2.3.8: How do I get searchlogic to work with bundler? 远程true无法在rails2.3.8中的表单中工作 - remote true not working in form in rails2.3.8 Ruby on Rails 2.3.8:我如何需要特定版本的gem? - Ruby on Rails 2.3.8: How do I require a specifc version of a gem? Ruby on Rails 2.3.8:环境定义了用于生产和开发的所有gem,如何指定测试gem? - Ruby on Rails 2.3.8: Environment defines all the gems used for production and development, how do you specify testing gems? 如何在 Rails 环境中运行 Ruby 文件? - How do I run a Ruby file in a Rails environment? 如何从Rails 2.3.8应用程序的Ruby 1.8.7升级到Ruby 1.9.2? - How do I upgrade from Ruby 1.8.7 to Ruby 1.9.2 for Rails 2.3.8 app? 如何运行Rails 2.3.8 - How to Run Rails 2.3.8 如何在Windows,Ruby 1.8.7,Rails 2.3.8上安装刻面,出现hpricot错误 - How do I install facets on windows, ruby 1.8.7, rails 2.3.8, I get hpricot error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM