News for hackers. Stuff that matters.

Ask HN: What do you while the automated tests are running?

I work on a Rails app with a fair amount of test coverage with Cucumber. It takes around 30 to 40 minutes to run the entire test suite. While the tests are running, I usually check my email, HN news, Stackoverflow and Reddit. They don't seem like the best use of my time. Can you share some things you do that's productive?
( 13 comments | 8 points | on HN )
Re:Ask HN: What do you while the automated tests are running? by grandalf on Monday August 26, 2013 @07:08PM (#6280503)
My guess is that you're testing AR associations all over the place and that the business logic in your models is tightly coupled to AR associations. This has the effect of slowing down testing tremendously.

I try to write code so that stuff that needs to be tested is not tied to AR. Why should your logic need to wait for AR to fetch records and fire a callback when the part that is likely to break (that isn't covered by AR's test suite) is your logic, not the data fetching or callback infrastructure.

Re:Ask HN: What do you while the automated tests are running? by stevoo on Tuesday August 27, 2013 @05:19AM (#6282365)
We dont run the entire test suit. Our last night test suit took 159 minutes to finish.

We automated that in order to run every night. We need a 100% pass rate before we push to production.

If you just do something you run those specific tests. If something else breaks due to that, it will be caught ( hopefully ) by the nightly tests.

Imagine having to run the test suite 2 - 3 times a day. Your day would be wasted !

Re:Ask HN: What do you while the automated tests are running? by candeira on Monday August 26, 2013 @06:39PM (#6280373)
I use my Ansible runs (which are much shorter, but still take a huge chunk of the day in agregate) to update my todos and timesheets, doodle ideas... and also to check email and HN. So it goes.

Of course, my Ansible runs are shorter because I try not to do the full run every time.

Re:Ask HN: What do you while the automated tests are running? by lifeisstillgood on Monday August 26, 2013 @07:01PM (#6280470)
Shorten the tests is one thing. A lot of database setups and tear downs? Try encapsulating each test in a transaction to keep it in memory.

Another thing is reading the docs of the libraries you use - reading around a subject is an under used and highly valuable activity.

Re:Ask HN: What do you while the automated tests are running? by chewxy on Monday August 26, 2013 @06:38PM (#6280368)
Actually relevant xkcd: http://xkcd.com/303/
Re:Ask HN: What do you while the automated tests are running? by adamconroy on Monday August 26, 2013 @09:37PM (#6280943)
I start planning my work for the next few hours, scratching down notes / sketching out an algorithm / design a screen / update my todo list . Although I have never had to wait more than 5 minutes for tests to run.
Re:Ask HN: What do you while the automated tests are running? by pherz on Monday August 26, 2013 @07:30PM (#6280581)
I work. Don't let tests dictate your workflow, start them and move onto something else. The results will wait until you have time to focus on them again.
Re:Ask HN: What do you while the automated tests are running? by barefoot on Monday August 26, 2013 @07:50PM (#6280634)
Do BDD tests typically take that long to run?

My unit tests take 1-50ms to run (the majority of them closer to 1ms) and I can run a decent suite of them in a few seconds.

Re:Ask HN: What do you while the automated tests are running? by jsnk on Monday August 26, 2013 @08:05PM (#6280680)
There's a huge room for improvement in my automation code here and there, but there are also some hard improvement barriers presented from using selenium webdriver. In the future, I am thinking about moving all the selenium webdriver tests to use phantomjs. I am also still using ruby 1.8.7. I hope that upgrading to ruby 2.0 will have noticeable improvement in speed.
Re:Ask HN: What do you while the automated tests are running? by georgebashi on Monday August 26, 2013 @07:01PM (#6280473)
You should set up something like Jenkins (or use a hosted solution like Travis), and keep working. No need to wait around for test results...
Re:Ask HN: What do you while the automated tests are running? by taproot on Monday August 26, 2013 @06:57PM (#6280448)
Office jousting.

Edit damn! Someone already posted the xkcd.

Re:Ask HN: What do you while the automated tests are running? by tjr on Monday August 26, 2013 @07:26PM (#6280561)
Try to schedule your tests to run over lunch, or during meetings, or kick them off at the end of a work day.
Re:Ask HN: What do you while the automated tests are running? by PhearTheCeal on Monday August 26, 2013 @06:40PM (#6280382)
I run the tests in a VM so that I can keep working on them while the tests are running.