Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何在聚合中评测我的Ruby测试套件?_Ruby On Rails_Ruby_Optimization_Testing_Profiling - Fatal编程技术网

Ruby on rails 如何在聚合中评测我的Ruby测试套件?

Ruby on rails 如何在聚合中评测我的Ruby测试套件?,ruby-on-rails,ruby,optimization,testing,profiling,Ruby On Rails,Ruby,Optimization,Testing,Profiling,通常的悲哀故事是:我的测试运行缓慢 我的第一个想法是对整个测试套件进行分析,以寻找明显的胜利(清除网络访问或缓存),因此我添加了一个ruby prof任务: RubyProf::ProfileTask.new(:units) do |t| t.test_files = FileList[RAILS_ROOT + '/test/unit/**/*_test.rb'] t.output_dir = Dir.tmpdir t.printer = :graph t.min_percent

通常的悲哀故事是:我的测试运行缓慢

我的第一个想法是对整个测试套件进行分析,以寻找明显的胜利(清除网络访问或缓存),因此我添加了一个ruby prof任务:

RubyProf::ProfileTask.new(:units) do |t|
  t.test_files = FileList[RAILS_ROOT + '/test/unit/**/*_test.rb']
  t.output_dir = Dir.tmpdir
  t.printer = :graph
  t.min_percent = 1
end

不幸的是,这会单独描述每个测试。有没有一种方法可以对所有这些测试类进行聚合?

您可以运行
ruby prof test\u suite\u name.rb
。您甚至不需要在测试中添加任何特定于ruby prof的代码。

可以在minitest中添加基准测试。

您是否尝试过只运行
ruby prof test\u suite\u name.rb
而不在测试中添加任何特定于ruby prof的代码?事实上,我没有考虑创建实际的测试套件。那可能有用!在我的普通Ruby对象项目中,创建测试套件很容易。只需要一个文件
需要
所有其他文件(或
需要
其他文件的文件)。然而,我不知道这是否能很好地发挥Rails的魔力。实际上,Rails测试中并没有那么多魔力。这很有效。我很乐意接受你的回答。