How software changes are tested and rolled out
Software keeps changing after its first release. OpenStax’s Introduction to Computer Science uses the word maintenance for updates made once software is deployed. It says most deployed software will need such updates sooner or later, whether to meet new requirements or to fix problems, and that maintenance can end up costing more than development did, especially when the software’s period of use is long [1]. Each update is a change, and this article is about how changes are checked and then delivered.
This article covers four things: why software is tested and which kinds of test a change meets; how tests are written, measured and automated; where testing fits in the common ways of organizing a software project; and how a tested change travels through test environments to production and reaches users in steps that can be halted or undone. It draws on chapter 9 of the book [1–7] and on four pages of Microsoft’s .NET guide to cloud-native applications [8–11]. The behavior of a running service when it fails, and the use of redundancy and failover against that, belong to the article Why big cloud services go down: redundancy, failover, and cascading failures, and are not repeated here. The article describes general practice, not any company’s releases or outages.
What testing is for
The book gives the purpose of testing as verifying that software being developed meets its requirements and has no unintended errors or side effects; put plainly, that its behavior matches what was expected [4]. Any issues found along the way can then be resolved, so that the integrity of the product is ensured [4].
Testing belongs in almost every phase of a project, the book says, with a different focus in each, and it gives “test early and test often” as an axiom [4]. The book adds that fixing or resolving an issue costs less the earlier in development it turns up [4]. Earlier in the chapter it also says testing should be repeated through the whole software process, whatever phase the work has reached [1].
The levels of testing
The book distinguishes three levels [4]:
-
Unit testing checks single components, such as one method or function, each in isolation, to see that it works as intended.
-
Integration testing checks the interfaces between components; its aim is that the components work together seamlessly.
-
In system testing the complete system is checked as a single piece against its overall requirements.
It lists further kinds of testing beside the levels [4]. Acceptance testing measures the software against what the client or end users expect and require. Usability testing judges ease of use and how intuitive the software is. Stress testing looks at the software’s performance when conditions are unfavorable or the load is heavy; performance testing examines speed, responsiveness and scalability under various conditions. Security testing finds vulnerabilities and deals with them, to guard against data breaches and unauthorized access.
Developers, among them the software engineers who wrote the code, carry out part of the testing. Most of it, the book says, falls to quality engineers whose main job is testing, and end users can join in through acceptance or user testing [4]. The book also describes one company’s public prerelease program for its operating system: anyone who agrees to try the coming version and report back can join, and such testers know that a prerelease may be unstable and likely has problems [4].
How a tester approaches the code
The book sorts its three primary testing methodologies by what the tester knows, or needs to know, about the code [4]. A white box tester knows the code and checks that the inner structure of what is being tested works properly. A black box tester works from the requirements and from what the item under test does, and needs no knowledge of its code. Gray box testing mixes the two: the test designer knows some of the code’s structure and understands how the software is meant to be designed [4].
The book distinguishes two kinds of check [4]. Verification tests whether the software runs without errors; in organizations with large development teams a quality assurance (QA) team often does it. Validation tests whether it “conforms to the requirements and does what the user wants it to do” [4]. Both require running the code, both can take place at any level of testing, and verification usually comes first [4]. A further split is by purpose: functional testing covers what the software does, nonfunctional testing covers qualities of the software, for example its performance, scalability and usability [4].
A good test, according to the book, has three marks. It has “a high probability of finding an error or issue”; it does not duplicate another test, which is what the book means by not redundant; and it “should be neither too simple nor too complex” [4].
Unit tests and the regression suite
Developers usually write unit tests, either while building software or while updating it; a unit test is a script or piece of code that checks what one particular piece of code does [4]. The book’s example is a function returning a rectangle’s area, whose unit test would check the returned area for several width and height pairs [4].
Unit tests typically go into a regression test suite [4], which can be rerun whenever the source code changes, to check that nothing that worked before has broken [4]. In this article’s reading, that rerun is how a change is checked against what the suite’s tests cover.
The book gives three benefits of unit testing: bugs turn up early, when fixing them is easier and cheaper, and writing the tests pushes developers toward clean, modular, well-documented code [4]; the tests also act as “living documentation” of each component’s intended behavior, which eases later changes [5]. Automated unit testing has some support in the major programming languages, and the book shows one such framework, which in some development environments typically runs with a single click [5].
How much of the code the tests reach
Code coverage is the usual measure of how far a unit test reaches: the percentage of the code that the test activates or reviews [5]. Three common forms appear in the book [5]. Statement coverage is the share of statements executed at least once when the whole set of tests runs. Line coverage the book defines as “the percentage of activated lines of source code that are tested”. Path coverage counts the possible routes through the source code and reports what percentage of them the tests follow.
The book’s worked case puts two conditional statements in sequence; code like that typically has four paths [5]:
-
both conditions true;
-
first true, second false;
-
first false, second true;
-
both false.
To cover every path takes at least four tests; to cover every statement takes at least two [5]. If each conditional has a true branch and a false branch, one test with both conditions true and one with both false run every statement between them, which is why two can suffice (our check). The book calls path coverage more demanding: compared with statement or line coverage it typically needs more tests, but better ones [5].
Paths multiply with each conditional added. n two-way conditionals in sequence allow at most 2 × 2 × … × 2 = 2^n paths: 4 for two, 8 for three, 1,024 for ten (our check: 2^10 = 1,024).
Writing the test first
In test-driven development (TDD), which many organizations use, the tests come before the code [6]. The book’s cycle has six steps [6]:
-
Pick one specific function or unit of code and write a unit test stating how it should behave.
-
Run it; it will likely fail at first, since the function does not exist yet or is incomplete.
-
Add only as much code as the test needs in order to pass.
-
Run the test again and watch it pass; passing, the book says, ensures that the code fulfills what the test defines.
-
Refactor: restructure the source for readability, maintainability and overall structure, leaving its behavior unchanged.
-
Rerun every test, to confirm the code still passes and the refactoring caused no unintended side effects.
Each unit of functionality goes through the cycle in turn [6]. The book names four benefits: clearer requirements; early bug detection; better design, since the approach can help bring out edge cases and scenarios that traditional development might overlook; and better code quality [6].
Its example for clearer requirements is a program that solves a quadratic equation for its real roots: starting from unit tests, a developer will probably see three cases needing separate handling, two roots, one root and none [6]. In this article’s reading, each case can become a test before any code exists. For ax² + bx + c = 0 the sign of b² − 4ac picks the case (our check):
-
x² − 5x + 6 = 0: b² − 4ac = 25 − 24 = 1, so two roots, x = (5 ± 1)/2, that is 2 and 3;
-
x² − 4x + 4 = 0: b² − 4ac = 16 − 16 = 0, so one root, x = 2;
-
x² + 1 = 0: b² − 4ac = 0 − 4 = −4, so no real root.
In this article’s reading, every line pairs an input with the answer a correct function has to give, which is what a unit test needs.
Testing the whole system, by hand and by program
System testing checks the finished, fully integrated product, to make sure it works as a whole as expected [6]. The book calls it generally black box testing, generally done by testers and not end users, covering functional and nonfunctional requirements alike [6].
Testers can run system tests, or the tests can be automated [6]. Manual testing means a person operates the system, supplies its input and checks every output by hand, and repeating a test means repeating all of that. Automated testing hands the running of tests to a program, which applies them to the system or to parts of it, so repeating a test costs the tester no repeated effort [6]. The book describes a suite of free tools for automated web application testing. In what the book calls the easiest way to use them, the tools capture how the browser and the web application interact and save that as a script, which can be edited if needed and replayed to check whether the application still works [6].
Acceptance testing, or user acceptance testing, settles whether the software meets the customer’s expectations; it usually comes after system testing and is carried out by the customer, the client or some other end user [6]. Its tests are formal, the customer can specify them, and they cover functional and nonfunctional requirements; on the functional side they often follow scenarios written down during requirements analysis [6]. The book’s example comes from a library information system: the tester completes the form for a new book, submits it and checks that the book is now in the system [6].
Where testing sits in a process model
When testing happens depends on how the project is organized. The waterfall model runs in strict order: requirements gathered and analyzed, the whole system designed and implemented, final testing, then deployment [2]. A drawback the book names is that the life cycle is well advanced before any software product exists, so customer feedback cannot be sought along the way [2]. The V-model is sequential too. What sets it apart is that testing is planned alongside design and implementation: each design or implementation step gets its own testing step, of the verification or the validation kind, and each pair of steps is planned in step with the other. Its advantage over the waterfall model, the book says, is that “verification and validation testing is more integrated into the overall process” [2].
The incremental model divides the work into increments covering smaller sets of requirements; because the increments are small, the book says, each one can be tested and can bring user feedback [2]. The book says this gives opportunities to catch errors or issues, and fix them, at an earlier stage than the waterfall and V-model methods would [2].
Agile process models are incremental and iterative [3]. Agile principles listed in the book include satisfying the customer by delivering software early and continuously, and delivering working software often, for example every couple of weeks [3]. Scrum, which the book lists among the approaches that complement Agile development, builds the product in sprints, fixed periods typically one to four weeks long [3].
DevOps, as the book describes it, joins the practices of software development with those of operations. Its development life cycle is short and it uses continuous delivery, with the aim of high-quality software products. It merges the two teams into one, whose engineers take part in planning, development, testing, deployment and operations alike, with the stages repeating as a continuous cycle [3]. The book credits the joint focus on development and operations with making errors or vulnerabilities less likely in a product once released, and says it can also speed up releases [3]. It adds that DevOps can struggle with complex and legacy systems, and that it needs strong teamwork and collaboration, without which it will likely fail [3]. Elsewhere in the chapter the book says that Agile methods together with DevOps automation have made deployment faster, more robust and more scalable, and that updates now ship frequently using continuous integration and deployment techniques and tools [1].
Continuous integration
The .NET guide describes continuous integration (CI) as building a project and testing it automatically once a change has been checked in, which lets mistakes surface early [8]. Before such builds, the .NET guide recalls, it was not unusual, after pulling code from the repository, to find it failing its tests or not even building, after which someone had to trace where the breakage came from [8].
The guide lists what can start a build: a manual start, a check-in, a schedule, or another build finishing. A build on every check-in is, it says, in most cases what a team wants [8]. Filters let builds differ by branch or by part of the repository. One use it gives: pull requests get fast builds that test less, and the trunk gets the full regression suite every night [8]. The files a build produces are called build artifacts [8].
Two practices from the book sit beside the automated build. In code review, one developer inspects another’s source code by hand; the book finds it especially useful when a team’s developers differ in experience [1]. A version control system records how the source code has changed over time and helps several developers work together; the book lists tracking changes and reverting them among the main features of Git [7].
Continuous delivery and release stages
Continuous delivery, which the guide calls the sister of continuous integration, takes the newly built packages and deploys them to an environment [8]. The guide notes that, traditionally, getting software into production took a list of manual steps with extensive documentation, and doing each by hand was very error prone. Manual work cannot scale to the pace of development; automation therefore matters more, and scripts take the place of checklists, doing the same tasks with more speed and accuracy than any human [8]. Continuous integration catches code problems early; continuous delivery, the guide says, catches deployment-process problems early in the same way [8].
The receiving environment could be a test environment, or it could be production itself, which the guide says many major technology companies use [8]. Delivering directly to production, it says, takes an investment in tests of high quality that “can give confidence that a change isn’t going to break production for users” [8].
The guide’s release tool works in stages. Each stage is an environment of its own, kept isolated, that receives the installed package; its example product uses three [8]:
-
development, which receives code continuously and on which automated tests can be run;
-
QA, where the release goes for manual testing once those tests have passed;
-
production, where everyone can see the code.
A stage can start automatically when the one before it finishes, but the guide says this is in many cases not wanted: moving code to production may need someone’s approval [8]. Rules can make a named person or group sign off before a release reaches production. The guide calls these approvals gates; they permit manual quality checks and compliance with whatever regulatory requirements apply to production [8]. The guide finds it advantageous to give each microservice one build pipeline or more; ideally, it says, microservices can be deployed independently to any environment, so each one can be released on a pipeline of its own, with no mass of unrelated code shipped alongside [8].
Releasing to users in steps
Reaching production does not have to mean reaching every user. The .NET guide describes two ways to limit who receives a change.
A canary release, which the guide offers as a strategy a team might set up to minimize the risk of deploying updates rapidly, begins by placing the new version in production while no traffic goes to it [9]. A small percentage of users is then sent to it; the team can then, as its confidence in the new version grows, expand it to more instances, at which point the old version can be retired [9].
Feature flags act inside the code. A feature flag is conditional logic that decides at run time whether users can see a piece of functionality [10]. A new feature can go into production with its availability restricted and later be turned on for chosen users, with no restart and no new deployment; in the guide’s words, flags “separate the release of new features from their code deployment” [10]. It calls one pattern common in modern cloud-native systems: a feature reaches production early, a limited audience tries it, and the audience widens step by step as confidence grows [10]. Other uses it gives include stabilizing a system by quickly turning off a problem feature, which avoids the risks of rolling back or of an immediate hotfix, and offering experimental features to small groups of users to validate their feasibility and popularity [10]. The guide advises keeping flag settings independent of the codebase; holding the flag configuration in a repository of its own lets a team change a flag’s state with no change to the application and no redeployment [10].
Trunk-based development, a branching model for source control in which developers work on features together, sharing one branch, is another practice the guide says flags promote. Merging many long-lived feature branches carries risk and complexity, and the guide says the approach minimizes both; the features stay off until switched on [10].
Undoing a change
This article counts three routes back from a change that goes wrong. One is the feature flag above, which turns a problem feature off without a rollback [10]. Another is returning the deployment to an earlier version. In the guide’s account of declarative deployments on Kubernetes, declarative deployments assist with releases, updates and scaling. The deployment controller takes its instructions from them for deploying new changes, for scaling out, and for rolling back to a previous revision [11]. An unstable cluster is returned automatically to the desired state by a declarative deployment; if a node crashes, for example, a replacement is deployed again [11]. Proposed changes can be previewed before they take effect, the guide adds, and a declarative configuration can be kept under version control next to the application code, which gives better change control [11]. The third route is in the source code: among the main features of Git, which the book names as today’s most popular version control system, is that it enables reverting changes [7].
A bug fix is itself a change. In its account of bug tracking, the book says code should be retested after a developer fixes a bug, to confirm the bug really is resolved [7].
The article’s assessment
This section is the article’s own reading of the sources above. None of them says tests find every error; the book says a good test has “a high probability of finding an error”, and coverage is a percentage of the code that the tests activate or review [4, 5]. Each further two-way conditional can double the number of paths, so ten in a row can give up to 1,024 paths to cover (our check).
Nor do the release practices in the .NET guide promise certainty. Delivery straight to production calls for high-quality tests that “can give confidence” about a change [8]; a canary release is offered as a way to minimize risk [9]; a feature flag lets a problem feature be switched off [10]; a deployment can be rolled back to a previous revision [11]. In this article’s reading, canary releases and feature flags limit how many users meet a change before it has been seen to work in production, while a feature flag gives a quick way to switch a problem feature off, and rollback a way back to a previous revision. Testing finds many problems before release; staged release and rollback are there for the ones it misses.
Not covered here
-
Redundancy, failover, cascading failures, and testing how a system behaves when its parts fail: see Why big cloud services go down: redundancy, failover, and cascading failures.
-
The expansion of the abbreviation CD: the sources expand it in more than one way, so this article does not use the abbreviation. It uses “continuous delivery” for the practice the .NET guide describes under that name [8], and where the book uses the term [3].
-
The book’s table comparing Site Reliability Engineering with DevOps (§9.2, p. 467), and Site Reliability Engineering in general.
-
The company and industry examples in §9.3: a stock exchange’s software (p. 468), the named operating-system prerelease programs (pp. 469–470), unit tests for a car’s lane detection system (p. 471), and acceptance testing by drivers who are then surveyed (p. 474). This article explains practice, not any company’s products.
-
The prototyping, spiral and Unified Process models (§9.2, pp. 460–463); debuggers, profilers and development environments (§9.3, pp. 476–477); and the commands and services of particular deployment tools.
Sources
Page numbers for Introduction to Computer Science are the printed pages. The .NET guide pages have no page numbers; locations are given by title and heading.
-
OpenStax, Introduction to Computer Science.
-
Microsoft, .NET architecture guide: Architecting Cloud Native .NET Applications for Azure, pages DevOps, Deploying containers in Azure, Feature flags and Leveraging containers and orchestrators.
-
[1]Introduction to Computer Science, §9.2, pp. 451–452 (testing throughout the process; code review; deployment; DevOps automation; frequent updates; maintenance and its cost). View at source ↗
-
[2]Same, §9.2, pp. 457–460 (the waterfall model and its drawbacks; the V-model; the incremental model). View at source ↗
-
[3]Same, §9.2, pp. 464–466 (Agile process models and principles; Scrum sprints; DevOps). View at source ↗
-
[4]Same, §9.3, pp. 468–470 (the purpose of testing; testing early; levels and other approaches; who tests; prerelease programs; white, black and gray box testing; verification and validation; functional and nonfunctional testing; a good test; unit testing; the regression test suite). View at source ↗
-
[5]Same, §9.3, pp. 471–472 (unit tests as documentation; code coverage: statement, line and path; the two-conditional example; support for unit testing). View at source ↗
-
[6]Same, §9.3, pp. 472–474 (test-driven development and its steps; the quadratic example; system testing; manual and automated testing; acceptance testing). View at source ↗
-
[7]Same, §9.3, pp. 477–478 (version control systems and Git; retesting after a bug fix). View at source ↗
-
[8]Microsoft, DevOps, under CI/CD pipelines, Azure Builds, Azure DevOps releases and Everybody gets a build pipeline (continuous integration and delivery; build triggers and filters; build artifacts; release stages and approvals; one pipeline per microservice).
-
[9]Microsoft, Deploying containers in Azure, under Azure Kubernetes Service (the canary release).
-
[10]Microsoft, Feature flags, introduction (what flags are and their uses; trunk-based development) and Implementing feature flags (flag settings kept outside the codebase).
-
[11]Microsoft, Leveraging containers and orchestrators, the section on declarative configuration (previewing changes; declarative deployments; rolling back to a previous revision; configuration versioned with the code).
Works cited
- Jean-Claude Franchitti (senior contributing author) et al., Introduction to Computer Science (OpenStax, Rice University, 2026). openstax.org/details/books/introduction-computer-science. License: CC BY-NC-SA 4.0. Access for free at openstax.org.
- Rob Vettor and Steve Smith, Architecting Cloud Native .NET Applications for Azure, edition v1.0.3 (Microsoft, 2022). learn.microsoft.com/dotnet/architecture/cloud-native. License: CC BY 4.0.