DEVOPS TESTING AT SPEED: WHY YOU NEED CI/CD
November 20, 2019
DevOps is a modern approach to software development that is now estimated to be used in more than half of all organisations globally. And if you’re in the software business (who isn’t?), adopting DevOps is fast becoming essential to the success of your organisation. Companies that embrace DevOps simply get more done. Improved time to production, business value and cost savings are typically cited as the top three drivers for DevOps adoption – read on to understand how DevOps achieves these incredible outcomes.
Firstly, it is important to understand how Quality Assurance (QA or software testing) responsibilities are different in DevOps, as getting this right is one of the keys to success. In the old world of software development, the traditional role of QA looks something like this:
- The QA team are handed a new build from the development team which is then deployed manually into a test environment.
- Problems in the test environment are ironed out.
- QA manually run a battery of time-consuming functional and regression tests to uncover any problems and to ensure the software works as intended. This process typically takes at least a few days.
- Defects are raised and reported to the development team to be corrected in future builds.
- A new build lands and the cycle continues.
- Eventually, the code is considered complete and is deployed into production.
In a DevOps environment, this approach would take far too much time. DevOps is consumed with speed and automation, and has re-imagined the old ways of software development, quality assurance and the role of operations when deploying code into production.
Whereas most organisations strive to release new code into production once every three months, organisations with mature DevOps practices will often push new code into production upwards of 20 times per day – with sophisticated teams releasing new software at a rate of more than 200 times per day. When you’re moving this fast, there is simply no time for traditional testing practices – a culture of quality needs to be built into the process throughout.
If you ever hear someone again utter the phrase “we’re not ready for testing yet” then you’re not doing DevOps.
The future of QA is Quality Engineering
Quality should be built in through process and technology. Continuous Testing is a foundational element of DevOps, and as software engineering teams increasingly embrace both test-driven development (TDD) and behaviour driven development (BDD), QA specialists who can automate their testing are making themselves increasingly invaluable. And those who can’t, are finding themselves increasingly less relevant.
Foundational to DevOps is the implementation of automated tests, which when run, verify the functionality of an application. Somewhat counter-intuitively, the more mature the practice, the smaller and more isolated the tests. This is due to the emergence of ‘Microservices’ application architectures – a topic for another blog post. The once popular ‘end-to-end automated testing’ approach is actually disappearing in mature DevOps practices.
These tests are commonly run by a tools such Gitlab or Bitbucket. These orchestration tools transform the time-consuming, manual task of building and testing software into a fast, automated process. This ‘Continuous Testing’ is more commonly known as ‘Continuous Integration’ and is the first step on your DevOps journey.
Continuous Integration (CI) refers to the practice of developers merging changes back into the main branch of a shared code repository as frequently as possible – ideally several times a day. A build is created and a suite of automated tests run against it to ensure that the new commits haven’t broken the application – allowing teams to detect and correct problems while they are easy to find and fix. Continuous Integration is cheap. Not integrating continuously is expensive. It works something like this:
- Developers check out code into their private workspaces
- When done, changes are committed to the repository
- The CI server monitors the repository and checks out changes when they occur
- The CI server builds the system and runs a series of unit and integration tests
- The CI server releases deployable artefacts
- The CI server assigns a build label to the version of the code it just built
- The CI server informs the team of the successful build
- If the build or tests fail, the CI server alerts the team
- The team fixes any issues at the earliest opportunity
- The team continually integrate and test throughout the project
Continuous Delivery (CD) is an extension of CI. On top of automated testing, the release process is also automated. Modern API-driven cloud infrastructure is automatically provisioned & configured, and the ‘deployable code artefact’ that was created at step 5 in the CI process above is automatically deployed into a staging environment for further testing. Once you’re happy, the new code can then be deployed into production at the click of a button.
Continuous Deployment (CD) goes one step further – any change that passes all stages of your production pipeline is released to your customers automatically. There’s no human intervention, and only a failed test will prevent a new change from being deployed into production. For continuous deployment to be viable, your culture of testing must be exemplary.
The outcome of all this automation is incredible speed; tiny, incremental improvements, bug fixes, tweak and changes are constantly streaming into production, delivering the following benefits:
- Faster delivery of features (happier customers)
- Fewer defects (happier business people)
- Faster resolution of problems (happier product teams)
- Less complex problems to fix (happier developers)
- More time is spent adding value than on bug fixes and maintenance (everyone is happier)
- Reduced waste – deploying code into production is typically a very big deal in most organisations, consuming enormous time and energy.
DevOps is the future of software development. It is a continuous improvement cycle with automation at its heart. As the world of software development again transitions to a new way of working, so too must those involved in the software development lifecycle (SDLC). CI/CD is changing the nature of the QA industry (as it is the world of server operations) through automation — and while the nature of testing is rapidly changing, the good news for QA specialists is that testing has never been so important.