Skip to content

Files

Failed to load latest commit information.

Latest commit

 Cannot retrieve latest commit at this time.

History

History

docs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Gem Version Build JRuby Build

TestProf

Ruby 测试的分析和优化工具箱。

TestProf 是一个分析你的测试套件性能的不同工具集。

为什么测试套件性能如此重要? 首先,测试是开发者反馈环的一部分(参看 @searls talk)。其次,它是部署周期的一部分。

简单来说,慢测试浪费你的时间,让你效率低下。

TestProf 工具箱旨在帮你识别测试套件的瓶颈。它包含:

  • 常规 Ruby 分析器(ruby-prof, stackprof)即插即用的整合。

  • 对 Factories 的使用采用了分析器。

  • ActiveSupport 所支持的分析器。

  • RSpec 和 minitest 的 帮助方法 以编写更快的测试。

  • RuboCop 的支持。

  • 更多……

📑 Documentation

TestProf map

Sponsored by Evil Martians

## TestProf 的用户

资源

安装

test-prof gem 添加到你的应用:

group :test do
  gem "test-prof"
end

就行了!

所支持的 Ruby 版本:

  • Ruby (MRI) >= 2.5.0(注意: 对于 Ruby 2.2 请使用 TestProf < 0.7.0,Ruby 2.3 请使用 TestProf ~> 0.7.0,Ruby 2.4 请使用 TestProf <0.12.0)

  • JRuby >= 9.1.0.0 (注意 refinements-dependent 特性可能需要 9.2.7+)

所支持的 RSpec 版本(仅 RSpec 特性): >= 3.5.0(对较旧版本 RSpec 请使用 TestProf < 0.8.0)。

所支持的 Rails 版本(仅适用于 Rails 功能):>= 5.2.0(对较旧版本 Rails 请使用 TestProf < 1.0)。

使用 RuboCop RSpec 进行 Lint

当使用 rubocop-rspec 对 RSpec spec 文件进行 lint 检查时,它将无法正确检测 TestProf 定义的 let_it_bebefore_all 这些 RSpec constructs。确保使用 rubocop-rspec 2.0 或更新版本,并将以下内容添加到 .rubocop.yml 中:

inherit_gem:
  test-prof: config/rubocop-rspec.yml

分析器

配方

我们也期望分享一些小的代码技巧,可以帮助你改进测试套件的性能和效率:

其他工具

下一步

有好的想法?提交一个功能需求吧!

已经在使用 TestProf 了?分享你的故事吧

许可协议

根据 MIT License 条款,本 gem 可开源使用。