Introduction to DevOps and Software Development Lifecycle (SDLC)

Chapter 8
Continuous Testing, Quality and DevSecOps

Diploma in DevOps
Introduction to DevOps and Software Development Lifecycle (SDLC)   •   Diploma

Continuous Testing, Quality and DevSecOps

Introduction

Modern software is delivered through automated pipelines, distributed teams, open-source dependencies and cloud platforms. In this environment, quality and security cannot be activities performed only at the end of development. A defect discovered after deployment may be expensive to correct, while a vulnerability may expose customer data, interrupt operations or create regulatory liability. Continuous testing and DevSecOps address these risks by making testing, security and quality part of the entire Software Development Lifecycle (SDLC).

Continuous testing is the practice of obtaining rapid, automated and reliable feedback about software quality throughout the delivery pipeline. DevSecOps extends DevOps by integrating security responsibilities, controls and evidence into development and operations rather than treating security as a final approval stage. These approaches do not eliminate manual expertise. Instead, they combine automation with risk-based human judgment.

A useful principle is that quality is built into a product; it is not inspected into it at the end. Testing provides evidence about quality, but testing alone cannot prove that software contains no defects. The objective is to reduce uncertainty to an acceptable level while delivering useful software safely and efficiently.

Learning Objectives

By the end of this chapter, a learner should be able to:

  • distinguish the major test levels, test types and testing techniques;
  • design an appropriate automated testing strategy for a delivery pipeline;
  • explain quality gates, test metrics and the role of non-functional testing;
  • apply shift-left and shift-right practices;
  • describe threat modeling, secure coding and security testing;
  • explain dependency scanning, secrets management and software-supply-chain security;
  • evaluate the benefits and limitations of DevSecOps in a practical scenario.

1. Quality in the SDLC

Software quality has several dimensions. Functional suitability asks whether the system performs required tasks. Reliability concerns consistent operation under stated conditions. Performance concerns response time, throughput and resource use. Usability concerns the ability of intended users to achieve goals. Maintainability concerns how easily software can be changed, tested and repaired. Security concerns confidentiality, integrity, availability, authenticity and accountability.

Quality therefore has both visible and less visible characteristics. A web application that calculates invoices correctly but exposes customer records is not a high-quality product. Similarly, an application that is secure but unusably slow may fail its business purpose.

Verification and validation

Verification asks, “Are we building the product correctly?” It includes reviews, static analysis and tests against specified requirements. Validation asks, “Are we building the correct product?” It includes user acceptance, exploratory testing and evaluation against business needs. Both are necessary. A system can conform perfectly to an incorrect requirement.

Defect prevention and defect detection

Defect prevention includes clear requirements, coding standards, design reviews, secure design and developer education. Defect detection includes automated tests, inspections and runtime monitoring. Prevention is usually less costly than late detection, but no realistic process prevents every defect. A mature process uses both.

A practical quality model combines:

  1. explicit acceptance criteria;
  2. peer review and automated static checks;
  3. tests at several levels;
  4. security and compliance controls;
  5. production observability and feedback;
  6. continual improvement based on evidence.

2. Test Levels and Test Types

Test levels describe the scope at which testing is performed. Test types describe the quality concern being examined. These categories overlap: for example, a performance test may be executed at component, API or system level.

Unit or component testing

Unit tests examine a small unit of code, such as a function or class, in isolation. Dependencies are commonly replaced by stubs, mocks or fakes. Unit tests are fast and help localize failures. They are especially valuable for business rules and data transformations.

Their limitation is scope. A collection of passing unit tests does not demonstrate that components communicate correctly or that the complete product satisfies users.

Integration testing

Integration tests examine interactions between components or services. Examples include a service communicating with a database, a message broker or an external payment provider. Integration tests reveal problems involving schemas, authentication, serialization, timeouts and configuration.

They are generally slower and more environment-dependent than unit tests. Teams should distinguish genuine integration tests from unit tests that merely use mocked interfaces.

System or end-to-end testing

System tests evaluate a complete application or a substantial user journey. An end-to-end test might create an account, place an order and verify confirmation. These tests provide high business confidence but are comparatively expensive, slow and sometimes fragile.

End-to-end tests should focus on critical paths rather than attempting to reproduce every possible condition through the user interface.

Acceptance testing

Acceptance testing determines whether the product meets business and stakeholder expectations. It may be automated using executable acceptance criteria, but human evaluation remains important for usability, operational readiness and ambiguous requirements.

Non-functional testing

Non-functional testing evaluates qualities such as:

  • performance and scalability;
  • resilience and disaster recovery;
  • accessibility and usability;
  • compatibility across browsers, devices and platforms;
  • security and privacy;
  • maintainability and operability.

A performance test should define workload, environment, measurements and pass criteria. A result obtained from a developer laptop cannot automatically represent production behavior.

Test techniques

Black-box techniques derive tests from externally visible behavior. Equivalence partitioning divides inputs into classes expected to behave similarly. Boundary-value analysis tests values at and near limits. Decision-table testing represents combinations of conditions and actions. State-transition testing examines behavior as an object changes state.

White-box techniques use knowledge of implementation, such as branch coverage or path analysis. Exploratory testing uses simultaneous learning, test design and execution. It is valuable when requirements are incomplete or risks are difficult to model, although it should be documented sufficiently to support learning and repeatability.

3. Automation and the Test Pyramid

Test automation uses software to prepare data, execute tests, compare actual and expected results, and report evidence. Automation is most valuable where tests are frequent, deterministic, repetitive and important to risk reduction.

A common test-pyramid model places many fast unit tests at the base, fewer integration and API tests in the middle, and a small number of end-to-end tests at the top. The pyramid is not a universal numerical rule. It is a design heuristic: broad fast feedback should be supported by a smaller set of slower tests.

Automation can fail when tests are brittle, poorly isolated, dependent on execution order or allowed to become outdated. A passing result is not useful if the test does not exercise meaningful behavior. Teams should treat test code as production code: review it, refactor it and maintain it.

Test reliability

A reliable test has a stable outcome when the software and test conditions have not changed. Flaky tests sometimes pass and sometimes fail without a relevant product change. Causes include race conditions, shared data, time dependence, unstable external services and inadequate cleanup.

Flaky tests reduce trust in the pipeline. Teams should measure, quarantine only temporarily, investigate root causes and remove or repair unreliable tests. Permanently ignoring failures converts automation into theatre.

Test data and environments

Test data should be representative but should not expose unnecessary personal or confidential information. Production data used for testing must be protected through minimization, masking or synthetic generation. Environments should be reproducible through version-controlled configuration and infrastructure as code where practical.

4. Continuous Testing in the Delivery Pipeline

A continuous delivery pipeline provides progressive feedback. A typical sequence is:

  1. developer commits code;
  2. source control triggers a build;
  3. formatting, linting, static analysis and unit tests run;
  4. an immutable artifact is created;
  5. integration and security tests run;
  6. the artifact is promoted through controlled environments;
  7. acceptance, performance or resilience tests run according to risk;
  8. deployment and production monitoring provide further evidence.

Not every test belongs in every pipeline stage. Fast, deterministic checks should normally run before slow or environment-intensive checks. Critical vulnerabilities or failed essential tests should block promotion. Lower-risk findings may create tracked work, depending on policy and context.

Quality gates

A quality gate is an explicit condition that must be met before a stage can proceed. Examples include:

  • compilation and packaging succeed;
  • all critical unit tests pass;
  • no unapproved critical vulnerability exists;
  • code review is complete;
  • test coverage for changed business-critical code meets policy;
  • an artifact has been signed and can be traced to source;
  • performance remains within an agreed service-level objective.

Quality gates should be risk-based and transparent. A gate based only on code coverage can be misleading because coverage measures execution, not the quality of assertions or requirements. Gates should combine several forms of evidence and include an approved exception process with an owner, reason, expiry date and compensating control.

Metrics and interpretation

Useful measures include escaped defects, defect-age distribution, failed-test rate, flaky-test rate, change-failure rate, vulnerability remediation time and deployment recovery time. Metrics must be interpreted in context. A rise in reported defects may indicate worse software, or it may indicate better detection and reporting.

Teams should avoid using metrics to punish individuals. When people are rewarded for reducing defect counts, they may suppress reporting or avoid difficult work. Metrics should support learning and system improvement.

5. Shift-Left and Shift-Right

Shift-left means moving suitable quality and security activities earlier in the SDLC. Examples include threat modeling during design, secure coding training, unit tests during implementation, dependency checks at commit time and automated policy checks in pull requests.

Shift-left provides earlier feedback, but it does not mean shifting every test to developers or eliminating later testing. Some risks can only be evaluated in realistic environments.

Shift-right means obtaining feedback after release. Practices include:

  • logs, metrics and distributed traces;
  • synthetic monitoring and real-user monitoring;
  • canary and blue-green releases;
  • feature flags and controlled experimentation;
  • resilience testing and recovery exercises;
  • incident response and post-incident learning.

Safe shift-right practice requires safeguards such as gradual exposure, rollback capability, privacy protection, alert ownership and tested recovery procedures. Production is part of the test environment, but it must never be treated as an uncontrolled experiment on users.

6. DevSecOps Foundations

DevSecOps integrates security into people, process and technology. It does not mean that developers alone become responsible for every security decision. Security specialists, developers, operations staff, product owners and leadership share responsibility, with clear accountability.

A DevSecOps operating model normally includes:

  • security requirements and abuse cases;
  • threat modeling and secure architecture;
  • secure coding standards and peer review;
  • automated static, dynamic and dependency testing;
  • secrets and identity management;
  • protected build and release infrastructure;
  • vulnerability management and incident response;
  • audit evidence and continuous improvement.

Security controls should be proportionate to risk. A public payment system and an internal prototype should not necessarily have identical controls, although both require responsible handling of vulnerabilities and secrets.

7. Threat Modeling

Threat modeling is a structured method for identifying threats, evaluating risk and selecting mitigations before implementation or release. It is most effective when repeated as architecture and threats change.

A practical process is:

  1. define system scope and security objectives;
  2. draw data flows, trust boundaries and external dependencies;
  3. identify valuable assets and potential misuse;
  4. identify threats;
  5. rank threats by likelihood and impact;
  6. select preventive and detective controls;
  7. assign owners and verify mitigations.

The STRIDE mnemonic is often used to classify threats: spoofing, tampering, repudiation, information disclosure, denial of service and elevation of privilege. STRIDE is a prompting framework, not a complete risk analysis. Teams must also consider privacy, safety, legal obligations, supply-chain compromise and business-specific threats.

A risk can be considered using a qualitative matrix or, where reliable data exists, a quantitative model. A simple expected-loss model is:

Expected loss = P(event) × Impact(event)

Here, P(event) is the probability of the event during the chosen period, and Impact is the financial or operational consequence in consistent units. This model assumes the probability and impact estimates are meaningful and that the selected events are defined clearly. In practice, uncertainty can be substantial, so qualitative categories and sensitivity analysis are often more honest than false precision.

8. Secure Coding and Security Testing

Secure coding reduces vulnerabilities through design and implementation practices. Important principles include least privilege, secure defaults, input validation, output encoding, parameterized database queries, safe error handling, strong authentication, authorization at every sensitive operation and protection against insecure deserialization.

Validation should be based on expected type, length, range and format. Encoding must be appropriate to the output context, such as HTML, SQL, a shell or a URL. A value safe in one context may be dangerous in another. Security controls should be centralized where practical, but critical authorization decisions must not depend only on user-interface behavior.

Security testing includes:

  • static application security testing, which analyzes source or compiled code;
  • dynamic application security testing, which examines a running application;
  • interactive testing, which combines runtime behavior with code context;
  • penetration testing, which uses expert, authorized attack simulation;
  • configuration and infrastructure scanning;
  • fuzz testing, which supplies unexpected or malformed inputs.

No single tool detects every vulnerability. Automated findings require triage because false positives and false negatives occur. Testing must be authorized, especially when it targets systems outside a controlled environment.

9. Dependency Scanning and Software-Supply-Chain Security

Applications frequently incorporate libraries, container images, operating-system packages, build tools and external services. This creates a software supply chain. A vulnerability or malicious change in a dependency can affect many downstream systems.

Software composition analysis identifies direct and transitive dependencies, compares versions against vulnerability intelligence and supports license review. Teams should maintain a software bill of materials (SBOM), preferably generated automatically and linked to released artifacts. An SBOM improves visibility but does not itself make software secure.

Supply-chain controls include:

  • pinning or constraining dependency versions;
  • verifying package signatures or trusted checksums;
  • using approved repositories and provenance records;
  • reviewing maintainer and release risks;
  • scanning source, dependencies, containers and infrastructure;
  • minimizing build privileges;
  • isolating build jobs;
  • signing artifacts and verifying signatures at deployment;
  • monitoring newly disclosed vulnerabilities;
  • maintaining a tested update and rollback process.

A dependency policy should distinguish exploitability from the existence of a vulnerability. A high-severity issue in unreachable code may require different treatment from a lower-severity issue exposed on a public endpoint. Exceptions must be documented and time limited.

10. Secrets Management and Identity

Secrets include passwords, API keys, private keys, access tokens and connection strings. They must not be placed in source code, issue trackers, container images or unprotected pipeline logs.

A secrets manager should provide controlled storage, access policies, encryption, audit logs and rotation support. Applications should receive only the secrets they need and only for the time required. Short-lived, automatically issued credentials are generally safer than permanent shared keys.

Secret scanning can detect accidental commits, but it cannot replace proper management. If a secret is exposed, the response is to revoke or rotate it, investigate use, remove it from future versions and assess affected systems. Merely deleting the visible line from the latest commit does not guarantee that it has disappeared from repository history or caches.

Identity and access management should apply least privilege, separation of duties and strong authentication. Pipeline identities are especially sensitive because a compromised build process may modify released software.

11. Case Study: Secure Delivery of a Student Payments Service

The following is an illustrative case.

Background

A university introduces a cloud-based service that allows students to view fees and make payments. The service contains personal and financial information and integrates with an external payment provider.

Problem

The initial team deploys manually every two weeks. Tests are mainly end-to-end browser tests, secrets are stored as pipeline variables shared by several jobs, and a dependency vulnerability is discovered after release. A penetration test also identifies an authorization flaw: a student can alter an account identifier in a request and view another student’s invoice.

Analysis

The process has several weaknesses. Slow end-to-end tests provide late feedback and do not adequately test business rules. Shared credentials violate least privilege. Dependency visibility is poor. Most importantly, authorization was not modeled as an explicit security requirement and was tested only through expected user-interface behavior.

Approach

The team redesigns the pipeline as follows:

  • unit tests cover fee calculations and authorization policy functions;
  • API integration tests verify database and payment-provider interactions;
  • a small set of end-to-end tests covers the critical payment journey;
  • threat modeling identifies personal-data disclosure, payment fraud and denial of service;
  • authorization tests use multiple student identities and attempt cross-account access;
  • dependencies are inventoried and scanned on every build;
  • a signed SBOM is attached to each release artifact;
  • secrets move to a managed vault with short-lived pipeline credentials;
  • critical static, dependency and authorization findings block release;
  • canary deployment and monitoring support controlled production rollout;
  • audit logs record administrative access without storing unnecessary payment data.

Outcome

The average feedback time for ordinary code changes decreases because fast tests run early. The organization gains visibility into dependency exposure and can trace each deployment to source, build and approvals. The authorization defect is detected before the next production release. Operational monitoring also identifies unusual access patterns after deployment.

Learning points

The case demonstrates that DevSecOps is not the purchase of a security scanner. It is an integrated system of requirements, design, automated evidence, identity controls, human review and operational feedback. It also demonstrates why test levels must complement one another: unit tests provide speed, integration tests provide interaction confidence, and targeted end-to-end tests provide business-flow confidence.

12. Governance, Ethics and Professional Practice

Testing and monitoring can process personal information. Organizations should collect only what is necessary, protect it, define retention periods and restrict access. Test data should be anonymized or synthetic whenever possible. Security testing must have written authorization, scope and rules of engagement.

Quality gates can create unfair outcomes if they block accessibility, localization or low-bandwidth use cases that were not represented in test data. Automated tools may contain bias or may prioritize easily measurable findings over serious but less visible risks. Human review is required for consequential decisions.

Regulated systems may require evidence of access control, change approval, vulnerability management, incident response and data protection. Teams should preserve useful audit evidence without retaining sensitive data unnecessarily. Compliance is a baseline, not a substitute for sound engineering judgment.

13. Challenges and Limitations

Continuous testing and DevSecOps have important limitations:

  • automation requires initial investment and continuing maintenance;
  • false positives can overwhelm teams;
  • tests may pass while requirements are wrong;
  • production behavior can differ from test environments;
  • legacy systems may be difficult to instrument;
  • security work can become a bottleneck if ownership is unclear;
  • excessive gates can reduce delivery flow without reducing meaningful risk;
  • tools cannot replace architecture, expertise or ethical judgment.

The appropriate response is not to remove controls but to improve their design. Teams should begin with high-risk journeys, establish reliable fast feedback, measure outcomes, automate repeatable work and review controls as the system changes.

Best-Practice Checklist

  • Define quality and security acceptance criteria before implementation.
  • Use a balanced test pyramid rather than relying only on UI tests.
  • Keep tests deterministic, isolated and maintainable.
  • Test functional and non-functional requirements.
  • Run fast feedback checks early and risk-intensive tests later.
  • Use quality gates based on risk and multiple evidence sources.
  • Threat-model significant changes and revisit models regularly.
  • Scan dependencies, containers, infrastructure and source code.
  • Generate and retain an SBOM for released artifacts.
  • Store secrets in a managed system and rotate exposed credentials.
  • Sign artifacts and protect build identities.
  • Monitor production and test recovery procedures.
  • Document exceptions with owners, expiry dates and compensating controls.
  • Protect personal data and obtain authorization for security testing.

Chapter Summary

Continuous testing extends quality feedback across the SDLC. Unit, integration, system and acceptance tests provide different levels of confidence, while non-functional testing examines performance, resilience, usability, accessibility and security. Automation is valuable when tests are meaningful, reliable and maintainable; the test pyramid encourages many fast tests and fewer broad, slow tests.

Quality gates turn expectations into explicit promotion criteria, but coverage or tool scores alone cannot define quality. Shift-left practices move suitable analysis into requirements, design and implementation. Shift-right practices use monitoring, controlled releases and operational learning after deployment.

DevSecOps integrates threat modeling, secure coding, security testing, dependency management, secrets protection, artifact provenance and incident response. Supply-chain security requires visibility and control over dependencies and build processes. Effective practice combines automation, professional judgment, governance and continual improvement.

Key Terms

Continuous testing: Repeated, automated and risk-based testing throughout the delivery lifecycle.

DevSecOps: An approach integrating security into development, delivery and operations.

Unit test: A test of a small software unit in isolation.

Integration test: A test of interactions between components or systems.

End-to-end test: A test of a complete business or user journey.

Acceptance test: Evaluation of whether software satisfies stakeholder requirements.

Non-functional testing: Testing of qualities such as performance, security and usability.

Test pyramid: A heuristic emphasizing many fast lower-level tests and fewer slower higher-level tests.

Flaky test: A test whose result changes without a relevant software or environment change.

Quality gate: A defined condition that must be satisfied before progression.

Shift-left: Moving quality or security activities earlier in the SDLC.

Shift-right: Obtaining quality and operational feedback after release.

Threat modeling: Structured identification and mitigation of threats.

Secure coding: Implementation practices that reduce vulnerabilities.

Software composition analysis: Examination of application dependencies for risk and licensing information.

SBOM: A software bill of materials listing components in a software artifact.

Secret: Sensitive credential material such as a token, password or private key.

Least privilege: Granting only the access necessary for an authorized task.

Artifact provenance: Evidence describing where and how a released artifact was produced.

Vulnerability: A weakness that can be exploited to violate security requirements.

Review Questions

Short Answer Questions

  1. What is the difference between verification and validation?
  2. Why are unit tests generally faster than end-to-end tests?
  3. Define a quality gate and give two examples.
  4. What is meant by shift-left security?
  5. Why should secrets not be stored in source code?

Long Answer Questions

  1. Explain the test pyramid and discuss its benefits and limitations.
  2. Describe how continuous testing can be organized across a CI/CD pipeline.
  3. Explain the threat-modeling process and the role of trust boundaries.
  4. Discuss how dependency scanning and SBOMs support supply-chain security.
  5. Compare shift-left and shift-right practices, including their risks and safeguards.

Analytical / Application Questions

  1. A team has 500 browser tests, few unit tests and frequent pipeline failures caused by timing issues. Analyze the situation and propose a revised testing strategy.
  2. A deployment contains a critical dependency vulnerability, but the vulnerable library is used only by an unreachable administrative feature. Recommend a release decision and identify the evidence and controls required.
  3. Design a DevSecOps approach for an application that stores student personal data and uses an external identity provider. Include threat modeling, testing, secrets management, quality gates and production monitoring.

Multiple Choice Questions with Answers

Question 1

Which test level primarily examines a small function or class in isolation?

A. Unit testing

B. System testing

C. Acceptance testing

D. Disaster-recovery testing

Correct Answer: A. Unit testing

Question 2

What is the main purpose of a quality gate?

A. To eliminate all manual testing

B. To define conditions for safely progressing to the next stage

C. To guarantee that no defect exists

D. To replace requirements analysis

Correct Answer: B. To define conditions for safely progressing to the next stage

Question 3

Which practice is an example of shift-left security?

A. Reviewing incident logs after an outage

B. Running threat modeling during system design

C. Conducting a customer survey after release

D. Performing disaster recovery after data loss

Correct Answer: B. Running threat modeling during system design

Question 4

What does a software bill of materials primarily provide?

A. A list of software components in an artifact

B. A guarantee that the artifact is vulnerability-free

C. A replacement for access control

D. A record of user-interface designs

Correct Answer: A. A list of software components in an artifact

Question 5

Which action is most appropriate when a secret is accidentally committed to a repository?

A. Rename the variable and leave the credential active

B. Delete only the latest visible line

C. Revoke or rotate the secret and investigate exposure

D. Ignore it if the commit was not deployed

Correct Answer: C. Revoke or rotate the secret and investigate exposure

Question 6

Which statement best describes a flaky test?

A. It always fails because a requirement is wrong

B. It changes result without a relevant product or environment change

C. It tests only security requirements

D. It runs only in production

Correct Answer: B. It changes result without a relevant product or environment change

Question 7

In threat modeling, which item represents a trust boundary?

A. A change in font size

B. A location where data crosses between different trust levels

C. A unit-test assertion

D. A release-calendar date

Correct Answer: B. A location where data crosses between different trust levels

Question 8

Why are end-to-end tests usually kept fewer than unit tests?

A. They cannot test business behavior

B. They are generally slower, more expensive and more fragile

C. They never require test data

D. They are always less valuable than static analysis

Correct Answer: B. They are generally slower, more expensive and more fragile

Question 9

What is the principle of least privilege?

A. Giving every service administrator access

B. Granting only the access necessary for an authorized task

C. Using one shared credential for all pipeline jobs

D. Allowing access until an incident occurs

Correct Answer: B. Granting only the access necessary for an authorized task

Question 10

Which control most directly supports artifact provenance?

A. Signing build artifacts and linking them to source and build records

B. Increasing the number of user-interface colors

C. Removing integration tests

D. Disabling audit logs

Correct Answer: A. Signing build artifacts and linking them to source and build records

Introduction to DevOps and Software Development Lifecycle (SDLC)
Chapter 8 of 14