/test-prof

Ruby Tests Profiling Toolbox

Primary LanguageRubyMIT LicenseMIT

Gem Version Build Status CircleCI

Code Triagers Badge

Ruby Tests Profiling Toolbox

TestProf is a collection of different tools to analyze your test suite performance.

Why does test suite performance matter? First of all, testing is a part of a developer's feedback loop (see @searls talk) and, secondly, it is a part of a deployment cycle.

Simply speaking, slow tests waste your time making you less productive.

TestProf toolbox aims to help you identify bottlenecks in your test suite. It contains:

  • Plug'n'Play integrations for general Ruby profilers (ruby-prof, stackprof)

  • Factories usage analyzers and profilers

  • ActiveSupport-backed profilers

  • Rubocop cops

  • etc.

Of course, we have some solutions for common performance issues too, bundled into the gem.

See Table of Contents for more.

Sponsored by Evil Martians

Resources

Installation

Add test-prof gem to your application:

group :test do
  gem 'test-prof'
end

And that's it)

Table of Contents

Checkout our guides for each specific tool:

Tips and Tricks (or Recipes)

We also want to share some small code tricks which can help you to improve your test suite performance and efficiency:

Configuration

TestProf global configuration is used by most of the profilers:

TestProf.configure do |config|
  # the directory to put artifacts (reports) in ("tmp" by default)
  config.output_dir = "tmp/test_prof"

  # use unique filenames for reports (by simply appending current timestamp)
  config.timestamps = true

  # color output
  config.color = true
end

What's next?

Or TODO list:

  • Better Minitest integration (PRs welcome!)

  • Other data generation library support (e.g Fabricator). Does anyone use something except from FactoryGirl?

  • Improve FactoryDoctor

  • Add more Rubocop cops (e.g. CreateListLimit)

License

The gem is available as open source under the terms of the MIT License.