I'm just coming across to RSpec from rake:test, and I'm struggling to find any equivalent to rake test:benchmark and/or rake test:profile.
So, what do most rspec folks use for performance testing? I've found --profile, which spits back the ten slowest tests, but I was hoping for something a little more comprehensive.
Cheers...
The Diaspora project took an interesting approach to performance testing with rspec -- tests that say "this method should be fast / take less than N ms"
https://github.com/diaspora/diaspora/blob/a6f8b2c14ed7ec13f2ecd113ae809a072814ab50/spec/controllers/aspects_controller_spec.rb#L92
Different than the typical approach but implementable without any half-baked rspec plugins
There is rspec-benchmark ruby gem which allows to test the performance in the clean and readable way:
expect { ... }.to perform_under(0.01).sec
You can also specify the number of times to run your code to measure performance:
expect { ... }.to perform_under(0.01).and_sample(10)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With