Ruby Tests Profiling Toolbox
Appraisal
Our great sponsors
Ruby Tests Profiling Toolbox | Appraisal | |
---|---|---|
7 | 3 | |
1,793 | 1,229 | |
1.2% | 0.5% | |
7.5 | 5.6 | |
8 days ago | about 1 month ago | |
Ruby | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Ruby Tests Profiling Toolbox
-
Must-have gems for mature Rails
gem "test-prof" - https://github.com/test-prof/test-prof | Toolkit for inspecting and optimising your test-suite, a must-have.
-
Measuring load time on fixtures
You might be able to do something with https://test-prof.evilmartians.io, but I'm not sure it has anything specific to fixtures out of the box. Maybe using the event profiler on sql.active_record events would be close enough. In the limit, you could wire together your own ActiveSupport::Notifications.instrument around the relevant blocks + an ActiveSupport::Notifications.subscribe to that event so as to log the relevant information. Docs: https://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
-
How to optimize factory creation.
To have a better vision of what objects are created in our spec file we can use test-prof, a powerful gem that provides a collection of different tools to analyse your test suite performance. One of this tool is really useful to identify a factory cascade, let’s introduce factory profiler.
-
A Trick For Reading Flamegraphs
TestProf can be used to get flamegraphs for Ruby test suites.
- How to improve a test suit made with Rspec, Capybara, FactoryBot and Siteprism
-
Does pytest break a lot of coding rules?
Rspec has spec_helper.rb.
-
Learning resources to broaden the knowledge
I also love the test-prof documentation, there's a lot of good ideas on how to improve test performance.
Appraisal
- What’s the best way to test a gem that integrates with Rails?
-
MatrixEval - A local alternative to GitHub Action/Circle CI/Travis CI matrix job. Simply run your code against different versions of dependencies.
appraisal can not do combination with multi Ruby versions. Check this issue: https://github.com/thoughtbot/appraisal/issues/182. appraisal users have to use CircleCI to do those things. But MatrixEval can combine all things, including Ruby version, everthing is up to you.
-
Researcher hacks over 35 tech firms in novel supply chain attack
remote: https://github.com/thoughtbot/appraisal
What are some alternatives?
DuckRails - Development tool to mock API endpoints quickly and easily (docker image available)
mutant - Automated code reviews via mutation testing - semantic code coverage.
Spinach - Spinach is a BDD framework on top of Gherkin.
Parallel Tests - Ruby: 2 CPUs = 2x Testing Speed for RSpec, Test::Unit and Cucumber
minitest - minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking.
Knapsack - Knapsack splits tests evenly across parallel CI nodes to run fast CI build and save you time.
timecop - A gem providing "time travel", "time freezing", and "time acceleration" capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
factory_bot - A library for setting up Ruby objects as test data.
vcr - Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
faker - A library for generating fake data such as names, addresses, and phone numbers.
rspec-side_effects - RSpec extension for checking the side effects of your specifications.