A build server is a dedicated machine used for building your applications. Build servers often are referred to...
as continuous integration servers; the two ideas are slightly different, but they often are combined on the same server. Each time a developer adds new code, the build server is notified of the addition. In response, the server will pull the new code from a code repository, build it from scratch and run all unit tests. The end result is a clean build of the most current code.
Technical managers sometimes question the usefulness of a build server when it seems an individual developer can achieve the same result by building on a local machine. However, build servers hold a few key advantages over the developer build approach.
Controlled, dependable and repeatable
A build server ensures that only the proper code goes into the build. Developers play with new software products, utility libraries or other tools on their local machines. Installing and uninstalling these tools can leave stray DLLs behind that may be mistakenly used in the build. This can lead to a frequently uttered phrase: "But it builds on my machine." Unchecked source code is also a common reason this phrase is uttered. With a dedicated build server, if it doesn't build on the build server, it's broken.
Another source of errors a build server can defend against is creating a release build instead of a debug build. During testing, developers may build the code with extra embedded information that aids debugging. This information slows execution and enlarges the resulting application, but is indispensable when fixing problems. The build server can be configured to build the application in release mode, which strips out all the debug information, making the application smaller and faster. The build also can be extended easily to build for multiple hardware targets, such as 32 or 64 bit.
Enforced unit tests
Forced unit test runs are another responsibility of the build server. It is easy for developers to forget to run unit tests before checking in code or decide that a change is small enough that it doesn't need a full unit test run. Build servers can enforce unit test success, even going so far as to reject a developer's code addition if any unit tests break during the build.
Applications often require more time- and data-intensive tests known as integration tests. These are tests that interact with the surrounding environment in some way, most commonly querying data from a database. Typically, these tests require a special set of data to exist on the database server in order for the test to pass.
In addition to requiring a special setup, these tests are also time-consuming to run. A properly configured continuous integration server can restore a test database with the data properly configured and then run the integration tests. Tests that take a significant amount of time can be scheduled to run during off hours.
Ensuring code quality
Build servers provide a central point to measure code quality. Test coverage metrics and other code quality measurements can be made during the build, providing incremental statistics on progress and quality. Extreme shops can go so far as to reject additions of code if coverage drops below a certain percentage.
One testing location for QA team
The advantages of a build server extend beyond developers. With a build sever in place, QA teams always know which version they need to test. This allows them to streamline their own workflow by introducing automated testing tools.
Every project, regardless of size, should use a build server. They enforce good development practices; provide a controlled, dependable build; enhance code quality; and are easy to set up.
Tools and trends surrounding continuous integration
Solutions to continuous integration testing challenges
Why open source rules legacy modernization efforts