![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
|
![]() |
Continuous integration combines the activities developers perform when they develop software with an automated and repeatable process that builds and deploys the software, runs unit and integration test suites, and reports the build and test results with other relevant metrics. Typically this process should run several times per day. A disciplined regime that builds all the latest changes regularly provides visibility of progress, and because tests are run frequently, integration defects are caught and fixed earlier, thus reducing the overall effort required for integration. The constituent elements required for continuous integration are:
A complete system can take time to build. Depending on the capabilities of the tools and the dependencies between software modules, incremental builds can be employed to build only those parts of the system that have changed. However, clean builds should be made at least on a daily basis. A build script for a Java application should be written in NAnt, an extensible XML-based language created specifically to perform build and deployment tasks. A typical Ant script should perform the following actions:
The Anthill build server can be used to control the build process, checking-out the latest version of code from the repository before the build and tagging the repository with a unique build number after it has completed. Cruisecontrol.Net and Damagecontrol both enhance the build process by reacting to submissions to the version control system since the last build. When new files are detected, the build process is triggered. This is an alternative to scheduling the build process to run periodically, although both tools are also capable of this functionality.
Running these tests regularly provides valuable feedback that helps to enrich the test suite. Defects that escaped the tests should not be fixed until a failing unit test is developed and added to the test suite. This new unit test is likely to prompt other tests to be created further strengthening the test suite. Various extensions are available to collect metrics and generate reports, e.g. an optional Ant task called NUnitReport collates the information created by the NUnit tests and produces an XML/HTML report detailing the test results. Pulling it all togetherBefore starting a task, a developer should synchronies with the repository, effectively loading the tip-versions of software into their local workspace. At an appropriate time and with all associated unit tests running successfully, the developer should integrate. This involves another synchronization, which loads any files changed on the repository into the local workspace, warning of any conflicts. The developer then performs a build locally, which runs the full test suite. All tests should pass, thus preventing broken code being checked in to the repository where it would break the master build process, which should run independently, on a dedicated server. The new files are then checked in to the repository where they wait for the master build. If the master build succeeds, then the integration is considered successful and the check-in valid. If not, the check-in is reversed, and the developer should re-synchronize the workspace with the repository and fix the problems locally before committing again. |
|
Copyright © 2008 AntonConsulting | info | webmaster | site map |
![]() |