DEV Community

Jess Lee
Jess Lee Subscriber

Posted on

What do you do while waiting for tests to finish running?

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)

Collapse
 
jess profile image
Jess Lee

...and yes I wrote this post while waiting for a test to run :)

Collapse
 
sergio profile image
deleteme deleteme • Edited

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.

https://i.imgur.com/IOnmN84.png

Collapse
 
maestromac profile image
Mac Siri

Hahaha, that picture is so appropriate. 800 tests in under 10 seconds is a dream for me.

Collapse
 
dangolant profile image
Daniel Golant

Curious what the real-world average spec/second count is in Rails world. Our suite clocks in at 886 specs in ~14.5s.

Thread Thread
 
maestromac profile image
Mac Siri

Wow dan, how many of those are feature and/or request specs? What's your secret to making the suit so fast?

Thread Thread
 
dangolant profile image
Daniel Golant

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.

Thread Thread
 
dangolant profile image
Daniel Golant

We should get together and talk shop sometime, now that I too am a Rails dev :D

Thread Thread
 
maestromac profile image
Mac Siri

Yes we should :)

Collapse
 
ananyaneogi profile image
Ananya Neogi • Edited

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. 🙂

Collapse
 
jess profile image
Jess Lee

Oh yeah, that's definitely the right move! I should get up from my seat more.

Collapse
 
maestromac profile image
Mac Siri

Groan about the slow testing speed and plot a plan to improve it.

Collapse
 
rhymes profile image
rhymes

Same here!

Collapse
 
lightalloy profile image
Anna Buianova

Choosing the SSD to buy, in my case :D

Collapse
 
qm3ster profile image
Mihail Malo • Edited

Didn't realize there are options besides Samsung 970 Pro.
What are you thinking?

Collapse
 
moopet profile image
Ben Sinclair

Wait, you're supposed to run tests?

Collapse
 
molly profile image
Molly Struve (she/her)

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.

Collapse
 
jess profile image
Jess Lee

That's a great call, thanks for sharing! I'm going to start doing this more.

Collapse
 
rhymes profile image
rhymes

I think: "how can I make them faster?" 🤣

Collapse
 
kritner profile image
Russ Hammett

xkcd.com/303/ applies to tests running as well IMO

Collapse
 
codingmindfully profile image
Daragh Byrne

Snap!

Collapse
 
thebouv profile image
Anthony Bouvier

Was looking to see if this was posted, cause I was going to!

:D

Collapse
 
shiling profile image
Shi Ling

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.

Collapse
 
shiling profile image
Shi Ling

Although sometimes I do get sucked into refactoring for too long and forget about the test...

Collapse
 
phillie profile image
Philly • Edited

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. 😅