Depending on what I'm working on, some tests take just long enough to run that I get distracted and move on to a totally different task (responding to a long overdue email, something the opposite of coding, etc.) which results in lots of context switching and re-orientating my focus.
What do you typically end up doing while waiting for tests to run?
I think this question is sort of similar, but with less predictable waiting time:
Top comments (64)
...and yes I wrote this post while waiting for a test to run :)
When I work in Rails: Read some news or watch some funny clips on youtube.
When I work in Elixir: No time to do anything really the tests run super quick. My longest time was 7 seconds and that was for about 800 tests.
Hahaha, that picture is so appropriate. 800 tests in under 10 seconds is a dream for me.
Curious what the real-world average spec/second count is in Rails world. Our suite clocks in at 886 specs in ~14.5s.
Wow dan, how many of those are feature and/or request specs? What's your secret to making the suit so fast?
IDK how many exactly, but I would say we have a decent amount. We don't do controller specs, so anything that test above the model/interactor is a request spec, though that gets tricky when we try to observe internal behavior.
Does your team use RackAttack or something similar for throttling? A colleague of mine figured out that a significant amount of time was being eaten up by testing throttling behavior. We tried just disabling the throttling, or adjusting the throttle threshold in
before
blocks, but that ended up causing other tests to flake, so I think the "final" fix was messing around with RackAttack's internal counter when throttling behavior gets tested and then resetting it to normal limits.We should get together and talk shop sometime, now that I too am a Rails dev :D
Yes we should :)
Hah! Guess who's checking dev.to right now while waiting for tests to run? Me😂
Most of the times, I would check out some articles from my endless list of bookmarks. I also tend to scroll through twitter or instagram(guilty!) but I am practising to reduce consumption of social media so instead I now force myself to have few sips of water and go around for a quick walk or at least do a little bit of leg stretching. 🙂
Oh yeah, that's definitely the right move! I should get up from my seat more.
Groan about the slow testing speed and plot a plan to improve it.
Same here!
Choosing the SSD to buy, in my case :D
Didn't realize there are options besides Samsung 970 Pro.
What are you thinking?
Wait, you're supposed to run tests?
I am a Site Reliability Engineer so when specs are running I am usually checking up on services. We use Datadog for monitoring and I will go in there and look at dashboards for things like Redis, Elasticsearch, and MySQL. We have alerts if anything breaks but I like looking at historical graphs to see if there are any interesting trends that might be worth investigating.
That's a great call, thanks for sharing! I'm going to start doing this more.
I think: "how can I make them faster?" 🤣
xkcd.com/303/ applies to tests running as well IMO
Snap!
Was looking to see if this was posted, cause I was going to!
:D
If the tests are under 10 minutes, I usually stay within my IDE, and start cleaning up code and improving documentation - these are small quick things I could do but they are endless hahaha.
If it's any longer, I shift my tests to a secondary monitor and go do big tasks and come back to the tests when I feel like it.
Although sometimes I do get sucked into refactoring for too long and forget about the test...
I’m either silently moaning all the time or ending up on Twitter or dev.to bookmarking posts I wanna read (but probably never will). But either way, always having a coffee first! 🤷♀️
I often meet my fav co-worker at the coffee machine - in that case we‘d be happily moaning together. 😅