|
| 1 | +[](https://rubygems.org/gems/test-prof) [](https://github.com/test-prof/test-prof/actions) |
| 2 | +[](https://github.com/test-prof/test-prof/actions) |
| 3 | + |
| 4 | +# TestProf |
| 5 | + |
| 6 | +> Ruby tests profiling and optimization toolbox |
| 7 | +
|
| 8 | +<img align="right" height="150" width="129" |
| 9 | + title="TestProf logo" class="home-logo" src="./assets/images/logo.svg"> |
| 10 | + |
| 11 | +TestProf is a collection of different tools to analyze your test suite performance. |
| 12 | + |
| 13 | +Why does test suite performance matter? First of all, testing is a part of a developer's feedback loop (see [@searls](https://github.com/searls) [talk](https://vimeo.com/145917204)) and, secondly, it is a part of a deployment cycle. |
| 14 | + |
| 15 | +Simply speaking, slow tests waste your time making you less productive. |
| 16 | + |
| 17 | +TestProf toolbox aims to help you identify bottlenecks in your test suite. It contains: |
| 18 | + |
| 19 | +- Plug'n'Play integration for general Ruby profilers ([`ruby-prof`](https://github.com/ruby-prof/ruby-prof), [`stackprof`](https://github.com/tmm1/stackprof)) |
| 20 | + |
| 21 | +- Factories usage analyzers and profilers |
| 22 | + |
| 23 | +- ActiveSupport-backed profilers |
| 24 | + |
| 25 | +- RSpec and minitest [helpers](#recipes) to write faster tests |
| 26 | + |
| 27 | +- RuboCop cops |
| 28 | + |
| 29 | +- etc. |
| 30 | + |
| 31 | +📑 [Documentation](https://test-prof.evilmartians.io) |
| 32 | + |
| 33 | +<p align="center"> |
| 34 | + <a href="http://bit.ly/test-prof-map"> |
| 35 | + <img src="./assets/images/coggle.png" alt="TestProf map" width="738"> |
| 36 | + </a> |
| 37 | +</p> |
| 38 | + |
| 39 | +<p align="center"> |
| 40 | + <a href="https://evilmartians.com/?utm_source=test-prof"> |
| 41 | + <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" |
| 42 | + alt="Sponsored by Evil Martians" width="236" height="54"> |
| 43 | + </a> |
| 44 | +</p> |
| 45 | + |
| 46 | +## Who uses TestProf |
| 47 | + |
| 48 | +- [Discourse](https://github.com/discourse/discourse) reduced [~27% of their test suite time](https://twitter.com/samsaffron/status/1125602558024699904) |
| 49 | +- [Gitlab](https://gitlab.com/gitlab-org/gitlab-ce) reduced [39% of their API tests time](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14370) |
| 50 | +- [CodeTriage](https://github.com/codetriage/codetriage) |
| 51 | +- [Dev.to](https://github.com/thepracticaldev/dev.to) |
| 52 | +- [Open Project](https://github.com/opf/openproject) |
| 53 | +- [...and others](https://github.com/test-prof/test-prof/issues/73) |
| 54 | + |
| 55 | +## Resources |
| 56 | + |
| 57 | +- [TestProf: a good doctor for slow Ruby tests](https://evilmartians.com/chronicles/testprof-a-good-doctor-for-slow-ruby-tests) |
| 58 | + |
| 59 | +- [TestProf II: Factory therapy for your Ruby tests](https://evilmartians.com/chronicles/testprof-2-factory-therapy-for-your-ruby-tests-rspec-minitest) |
| 60 | + |
| 61 | +- Paris.rb, 2018, "99 Problems of Slow Tests" talk [[video](https://www.youtube.com/watch?v=eDMZS_fkRtk), [slides](https://speakerdeck.com/palkan/paris-dot-rb-2018-99-problems-of-slow-tests)] |
| 62 | + |
| 63 | +- BalkanRuby, 2018, "Take your slow tests to the doctor" talk [[video](https://www.youtube.com/watch?v=rOcrme82vC8)], [slides](https://speakerdeck.com/palkan/balkanruby-2018-take-your-slow-tests-to-the-doctor)] |
| 64 | + |
| 65 | +- RailsClub, Moscow, 2017, "Faster Tests" talk [[video](https://www.youtube.com/watch?v=8S7oHjEiVzs) (RU), [slides](https://speakerdeck.com/palkan/railsclub-moscow-2017-faster-tests)] |
| 66 | + |
| 67 | +- RubyConfBy, 2017, "Run Test Run" talk [[video](https://www.youtube.com/watch?v=q52n4p0wkIs), [slides](https://speakerdeck.com/palkan/rubyconfby-minsk-2017-run-test-run)] |
| 68 | + |
| 69 | +- [Tips to improve speed of your test suite](https://medium.com/appaloosa-store-engineering/tips-to-improve-speed-of-your-test-suite-8418b485205c) by [Benoit Tigeot](https://github.com/benoittgt) |
| 70 | + |
| 71 | +## Installation |
| 72 | + |
| 73 | +Add `test-prof` gem to your application: |
| 74 | + |
| 75 | +```ruby |
| 76 | +group :test do |
| 77 | + gem "test-prof" |
| 78 | +end |
| 79 | +``` |
| 80 | + |
| 81 | +And that's it) |
| 82 | + |
| 83 | +Supported Ruby versions: |
| 84 | + |
| 85 | +- Ruby (MRI) >= 2.5.0 (**NOTE:** for Ruby 2.2 use TestProf < 0.7.0, Ruby 2.3 use TestProf ~> 0.7.0, Ruby 2.4 use TestProf <0.12.0) |
| 86 | + |
| 87 | +- JRuby >= 9.1.0.0 (**NOTE:** refinements-dependent features might require 9.2.7+) |
| 88 | + |
| 89 | +Supported RSpec version (for RSpec features only): >= 3.5.0 (for older RSpec version use TestProf < 0.8.0). |
| 90 | + |
| 91 | +## Profilers |
| 92 | + |
| 93 | +- [RubyProf Integration](./profilers/ruby_prof.md) |
| 94 | + |
| 95 | +- [StackProf Integration](./profilers/stack_prof.md) |
| 96 | + |
| 97 | +- [Event Profiler](./profilers/event_prof.md) (e.g. ActiveSupport notifications) |
| 98 | + |
| 99 | +- [Tag Profiler](./profilers/tag_prof.md) |
| 100 | + |
| 101 | +- [Factory Doctor](./profilers/factory_doctor.md) |
| 102 | + |
| 103 | +- [Factory Profiler](./profilers/factory_prof.md) |
| 104 | + |
| 105 | +- [RSpecDissect Profiler](./profilers/rspec_dissect.md) |
| 106 | + |
| 107 | +## Recipes |
| 108 | + |
| 109 | +We also want to share some small code tricks which can help you to improve your test suite performance and efficiency: |
| 110 | + |
| 111 | +- [`before_all` Hook](./recipes/before_all.md) |
| 112 | + |
| 113 | +- [`let_it_be` Helper](./recipes/let_it_be.md) |
| 114 | + |
| 115 | +- [AnyFixture](./recipes/any_fixture.md) |
| 116 | + |
| 117 | +- [FactoryDefault](./recipes/factory_default.md) |
| 118 | + |
| 119 | +- [FactoryAllStub](./recipes/factory_all_stub.md) |
| 120 | + |
| 121 | +- [RSpec Stamp](./recipes/rspec_stamp.md) |
| 122 | + |
| 123 | +- [Tests Sampling](./recipes/tests_sampling.md) |
| 124 | + |
| 125 | +- [Active Record Shared Connection](./recipes/active_record_shared_connection.md) |
| 126 | + |
| 127 | +- [Rails Logging](./recipes/logging.md) |
| 128 | + |
| 129 | +## Other tools |
| 130 | + |
| 131 | +- [RuboCop cops](./misc/rubocop.md) |
| 132 | + |
| 133 | +## What's next |
| 134 | + |
| 135 | +Have an idea? [Propose](https://github.com/test-prof/test-prof/issues/new) a feature request! |
| 136 | + |
| 137 | +Already using TestProf? [Share your story!](https://github.com/test-prof/test-prof/issues/73) |
| 138 | + |
| 139 | +## License |
| 140 | + |
| 141 | +The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). |
0 commit comments