How long should the Continuous Integration process take (i.e. compiling classes and running unit tests + integration test)?
On my current project it takes about 30 minutes, is that OK?
What’s the ideal length of build time?
Integration tests take most of that time, if the 30 min is too long what can be done here?
What’s the impact of having the build complete in 30 min?
Separate your unit-tests or otherwise quick tests from slower integration tests. Try to keep the ‘commit’ tests under 10 minutes (not much more time then it takes to grab a cup of coffee).
Split unit-tests from anything that requires an installed system to test against. Run those at a second test stage.
There really is no hard number, if you have a large system, keeping it all under 10 minutes can be hard. Just try keeping it as short as possible.
As for the first-line (unit) tests: According to Michael Feathers (“Working Effectively with Legacy Code”), more than a few seconds to compile and test your class locally is too long (causing you to start cheating away from the TDD method).
The ultimate goal is to provide feedback while the details of the task are still in short term memory. According to some sources, the duration of short term memory can be as low as 15-30 seconds, so a target compile-and-test cycle of around 5-10 seconds would seem to be a well motivated and rational answer.
Unfortunately, practical considerations make this target exceedingly difficult to achieve without considerable engineering effort. It is my hope that future development automation tools will help with the difficult tasks of fine-grained dependency analysis, compilation unit and test case selection.