Continuous Integration & Continuous Delivery


Continuous Integration

Continuous integration (CI) is a practice where a team of developers integrate their code early and often to the main branch or code repository. The goal is to reduce the risk of seeing “integration hell” by waiting for the end of a project or a sprint to merge the work of all developers.

One of the primary benefits of adopting CI is that it will save you time during your development cycle by identifying and addressing conflicts early. It’s also a great way to reduce the amount of time spent on fixing bugs and regression by putting more emphasis on having a good test suite. Finally, it helps share a better understanding of the codebase and the features that you’re developing for your customers.

Continuous Delivery

Continuous delivery is an extension of continuous integration to make sure that you can release new changes to your customers quickly in a sustainable way. This means that on top of having automated your testing, you also have automated your release process and you can deploy your application at any point of time by clicking on a button.

In theory, with continuous delivery, you can decide to release daily, weekly, fortnightly, or whatever suits your business requirements. However, if you truly want to get the benefits of continuous delivery, you should deploy to production as early as possible to make sure that you release small batches that are easy to troubleshoot in case of a problem.

Getting started with automated testing

Understanding the different types of tests

To get the full benefits of CI, you will need to automate your tests to be able to run them for every change that is made to the main repository. We insist on running tests on every branch of your repository and not just focus on the main branch. This way you will be able to capture issues early and minimize disruptions for your team.
There are many types of tests implemented, but it is not necessary to do everything at once if you’re just getting started. You can start small with unit tests and work on extending your coverage over time.
  • Unit tests are narrow in scope and typically verify the behaviour of individual methods or functions.
  • Integration tests make sure that multiple components behave correctly together. This can involve several classes as well as testing the integration with other services.
  • Acceptance tests are similar to the integration tests but they focus on the business cases rather than the components themselves.
  • UI tests will make sure that the application functions correctly from a user perspective.

Continuous integration in 5 steps

You should now have a good idea of the concepts behind continuous integration, and we can boil it down to this:
  • Start writing tests for the critical parts of your codebase.
  • Get a CI service to run those tests automatically on every push to the main repository.
  • Make sure that your team integrates their changes everyday.
  • Fix the build as soon as it’s broken.
  • Write tests for every new story that you implement.