为什么我运行任务时:

my_project> rake  import:twitter

task.path:lib/task/import_twitter.rake

namespace :import do
   task :twitter => :environment do
     puts "importing...."
   end
end

然后测试也运行吗?

在控制台输出中:

    importing....
    Loaded suite C:/Ruby/bin/rake
    Started


    Finished in 0.001 seconds.

    0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifica
    tions
    0% passed

执行任务时如何不运行测试?

有帮助吗?

解决方案

嗨,您可以编写您的任务,然后编写新的任务,该任务将调用两个单独的任务 - 运行测试和您的类似 task :run_all => ['db:test:clone ', 'db:test:prepare ', 'test:units', :your_task]

其他提示

没有执行测试(您始终具有计数0)。

如果您加载,请始终获得测试统计量 test/unit. 。只需尝试以下文件:

require 'test/unit'

如果您在任何地方加载,您可以检查您的Rakefile吗 test/unit? (也许是一个必需的文件之一)您可以检查 $" 如果包含 test/unit

背景:测试单元开始 at_exit (脚本结束)一些例程,并在test :: unit :: TestCase中寻找测试方法并执行它们。此后,统计量是编写的。没有测试,您将获得“空”测试统计量。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top