What is “Continuous Integration”?
“Continuous Development” or “CI” in short is a concept which has been taken as a standard now a days within our IT services and development. The concept Continuous Integration means automating the overall deployment process for an application after a code has been committed. It helps in reducing bugs in the deployment process. Besides this it also helps in reducing complexity within the code and increases clarity of each module.
The concept was initially brought in by “Grady Booch” in the year 1991. Although he did not suggest making continuous integration as a part of the build process for an entire application. As technologies advanced, with that increased complex business procedures and software code. To mitigate the process of version controlling for the entire application and to channelise more cleaner code into the source control, it became important to automate the entire process of building the entire application after every commit made by a developer. Thus Continuous Integration became very important for “Extreme Programming” process. I will explain “Extreme Programming” separately in some other blog.
The main concern of continuous integration is to resolve Integration problems. In Extreme Programming continuous integration was intended to be used in combination with automated unit tests written through the practices of test-driven development. Initially this was conceived of as running all unit tests in the developer’s local environment and verifying they all passed before committing to the mainline. This helps avoid one developer’s work-in-progress breaking another developer’s work. In the same vein, the practice of continuous delivery further extends continuous integration by making sure the application checked in on the mainline is always in a state that can be deployed to users and makes the actual deployment process very rapid.
How does continuous integration work?
To achieve the required objectives continuous integration depends upon the following points:
Maintain a code repository
This practice advocates the use of a revision control system for the project’s source code. All artefacts required to build the project should be placed in the repository.
Automate the build
A single command should have the capability of building the system. Automation of the build should include automating the integration, which often includes deployment into a production-like environment.
Make the build self-testing
Once the code is built, all tests should run to confirm that it behaves as the developers expect it to behave.
Keeping the build fast
The build needs to complete rapidly, so that if there is a problem with integration, it is quickly identified.
Making it easy to get the latest deliverables
Making builds readily available to stakeholders and testers can reduce the amount of rework necessary when rebuilding a feature that doesn’t meet requirements. Additionally, early testing reduces the chances that defects survive until deployment. Finding errors earlier also, in some cases, reduces the amount of work necessary to resolve them.
Verifying the latest builds
It should be easy to find out if build breaks and what relevant changes has to be made.
The entire process can be automated by injecting scripts into the continuous integration system. By this we can automate the entire build just using a single script.
Benefits of using Continuous Integration
Continuous integration is intended to produce benefits such as:
- Integration bugs are detected early and are easy to track down due to small change sets. This saves both time and money over the lifespan of a project.
- Avoids last-minute chaos at release dates, when everyone tries to check in their slightly incompatible versions
- When unit tests fail or a bug emerges, if developers need to revert the codebase to a bug-free state without debugging, only a small number of changes are lost (because integration happens frequently)
- Constant availability of a “current” build for testing, demo, or release purposes
- Frequent code check-in pushes developers to create modular, less complex code.
Besides this, continuous automated testing benefits can include:
- Enforcing discipline of frequent automated testing
- Immediate feedback on system wide impact of local changes
- Metrics generated from automated testing and CI (such as metrics for code coverage, code complexity, and features complete) focus developers on developing functional, quality code.
Continuous Integrations can be carried out using tools like
- Travis CI
These CI tools are very easy to use and provides available plugins so that you can integrate it with your version controlling system softwares and automating your build processes.
I will be covering how can you use Jenkins CI to automate your test process. Till then stay tuned ….