Ruby Tests Profiling Toolbox v0.9.0 Release Notes
Release Date: 2019-05-14 // almost 5 years ago-
๐ This release is inspired by ideas discussed and implemented in this PR to Discourse. Specials thanks to @danielwaterworth and @SamSaffron.
tl;dr
before_all
hooks,let_it_be
aliases, better Fabrication support.before_all
- Added global callbacks to
before_all
.
โช Now you can execute additional code before and after every
before_all
transaction begins and rollbacks:TestProf::BeforeAll.configure do |config| config.before(:begin) do# do something before transaction opensend config.after(:rollback) do# do something after transaction closesendend
let_it_be
Added ability to use
let_it_be
aliases with predefined options.TestProf::LetItBe.configure do |config| config.alias_to :let_it_be_with_refind, refind: trueend
โ Then use it in your tests:
describe "smth" do let\_it\_be\_with\_refind(:foo) { Foo.create } # refind can still be overridden let\_it\_be\_with\_refind(:bar, refind: false) { Bar.create }end
FactoryProf
โ Added timings to FactoryProf report.
[TEST PROF INFO] Factories usage
Total: 15285
Total top-level: 10286
Total time: 299.5937s
Total uniq factories: 119total top-level total time top-level time name 6091 2715 115.7671s 50.2517s user 2142 2098 93.3152s 92.1915s post
FactoryDoctor
โ Added Fabrication support.
โ Added threshold and instrumentation event customization.
NOTE: default threshold is 0.01s (i.e. if the DB time is less for the example, we consider it "good").
$ FDOC=1 FDOC\_EVENT="sql.rom" FDOC\_THRESHOLD=0.1 rspec
EventProf
- โ Added
guard
andtop_level
options toEventProf::Monitor
.
For example:
TestProf::EventProf.monitor( Sidekiq::Client, "sidekiq.inline", :raw\_push, # top\_level: true means that we do not trigger events when the method is# called recursively within itselftop\_level: true, # only trigger the event when guard returns `true`guard: -\>(\*) { Sidekiq::Testing.inline? } )
- โ Added Fabrication support for
factory.create
event.
- Added global callbacks to