loading...

re: A tip for faster Rails Helpers Tests VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Interesting topic! In your experience, how much time has this shaved off your tests? I am not sure that this is the bottle neck in a test suite I w...
 

This is not really a tip to improve the time of your whole test suite... is mostly a tip to be able to do TDD on a helper in a faster way.

This are some results in my machine...

  • Using requiere "rails_helper"...
Finished in 5.66 seconds (files took 8.85 seconds to load)
21 examples, 0 failures

Randomized with seed 36477


real   0m15.406s
user   0m7.568s
sys    0m3.834s
  • Using the tip in the article...
Finished in 0.11966 seconds (files took 2.23 seconds to load)
21 examples, 0 failures

Randomized with seed 52780


real    0m3.157s
user    0m2.062s
sys     0m1.037s

Maybe for some people the difference is not that much... but I am use to do TDD without rails, and I really feel frustrated with slow tests =S...

For example our whole suite of use case tests, run like this...

Finished in 8.33 seconds (files took 3.69 seconds to load)
2371 examples, 0 failures

Randomized with seed 57751


real    0m12.863s
user    0m10.923s
sys     0m1.523s

We run more than 2000 tests in almost the same time than 21 tests for just a helper =S ... that why for me is helpful =)...

But really it will depend a lot on the size of the app you are working on and how much time it takes to start.

 

Totally, it’s all relative. For what it’s worth, cutting helper tests from 5s to .1s is incredibly helpful!

Code of Conduct Report abuse