0

I've stared to work on developing larger applications, and am struggling to adjust around non-instant builds. Before I would make a small change, then build and test that change. This doesn't work so well when building + unit tests take several minutes. Any suggestions?

Edit - The suggested duplicate is about how to decrease unit test time. My question is not about how to speed up builds, but how to work with long build times.

niznuck
  • 29
  • 3
  • 1
    Possible duplicate of [How do we make unit tests run fast?](http://programmers.stackexchange.com/questions/184834/how-do-we-make-unit-tests-run-fast) – Scant Roger Dec 14 '15 at 03:16
  • Why is a build that takes several minutes a problem? –  Dec 14 '15 at 04:11
  • If you're used to, say, testing browser based JS in firebug, I can see a few minutes being a shock. Is there any intrinsic reason you can't factor around the issue? I.e. only build the parts you are testing independently from the rest of the project? – sqykly Dec 14 '15 at 04:37
  • If your build process takes several minutes to run unit tests for the piece of software you've just changed, your process is wrong. Also, your unit tests should take no more than a few seconds to run, and THERE IS ABSOLUTELY NO POINT in optimizing a process that takes only a few seconds. – BobDalgleish Dec 14 '15 at 12:56
  • @BobDalgleish If your build process takes several minutes to run unit tests for the piece of software you've just changed, you may be using C++ in which this is virtually unavoidable. – pjc50 Dec 14 '15 at 13:59
  • Where I work, even the integration tests run in mere seconds. It's always the compiling and linking that take forever; given your dependencies there's often nothing you can do about it.. – Ixrec Dec 20 '15 at 00:40

1 Answers1

5

Three possibilities:

  • Parallelize: find someting else that you can do while waiting for the build: answer some email, write documentation, whatever. But the mental context switching overhead makes this work pretty badly in many cases.
  • Improve your build or modularize the project to allow incremental deployments or partial test runs, so that you don't have to build the entire project to run some unit tests.
  • Work in larger increments and reduce the number of test cycles. Do more than just some small change before running the build/test step, be more mindful and conscientious to avoid wasting a test cycle on trivial mistakes.

And whenever you're annoyed about waiting 5 minutes for your build to complete, remember that not too long ago, developers wrote their programs on paper and it could take a whole day before they got any result, even if it was just a compiler error because of a typo...

Michael Borgwardt
  • 51,037
  • 13
  • 124
  • 176