[英]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.