DevOps help for Cloud Platform Engineers
  • Welcome!
  • Quick Start Guide
  • About Me
  • CV
  • Contribute
  • ๐Ÿง DevOps & SRE Foundations
    • DevOps Overview
      • Engineering Fundamentals
      • Implementing DevOps Strategy
      • DevOps Readiness Assessment
      • Lifecycle Management
      • The 12 Factor App
      • Design for Self Healing
      • Incident Management Best Practices (2025)
    • SRE Fundamentals
      • Toil Reduction
      • System Simplicity
      • Real-world Scenarios
        • AWS VM Log Monitoring API
    • Agile Development
      • Team Agreements
        • Definition of Done
        • Definition of Ready
        • Team Manifesto
        • Working Agreement
    • Industry Scenarios
      • Finance and Banking
      • Public Sector (UK/EU)
      • Energy Sector Edge Computing
  • DevOps Practices
    • Platform Engineering
    • FinOps
    • Observability
      • Modern Practices
  • ๐Ÿš€Modern DevOps Practices
    • Infrastructure Testing
    • Modern Development
    • Database DevOps
  • ๐Ÿ› ๏ธInfrastructure as Code (IaC)
    • Terraform
      • Cloud Integrations - Provider-specific implementations
        • Azure Scenarios
          • Azure Authetication
            • Service Principal
            • Service Principal in block
            • Service Principal in env
        • AWS Scenarios
          • AWS Authentication
        • GCP Scenarios
          • GCP Authentication
      • Testing and Validation
        • Unit Testing
        • Integration Testing
        • End-to-End Testing
        • Terratest Guide
      • Best Practices
        • State Management
        • Security
        • Code Organization
        • Performance
      • Tools & Utilities - Enhancing the Terraform workflow
        • Terraform Docs
        • TFLint
        • Checkov
        • Terrascan
      • CI/CD Integration - Automating infrastructure deployment
        • GitHub Actions
        • Azure Pipelines
        • GitLab CI
    • Bicep
      • Getting Started - First steps with Bicep [BEGINNER]
      • Template Specs
      • Best Practices - Guidelines for effective Bicep implementations
      • Modules - Building reusable components [INTERMEDIATE]
      • Examples - Sample implementations for common scenarios
      • Advanced Features
      • CI/CD Integration - Automating Bicep deployments
        • GitHub Actions
        • Azure Pipelines
  • ๐Ÿ’ฐCost Management & FinOps
    • Cloud Cost Optimization
  • ๐ŸณContainers & Orchestration
    • Containerization Overview
      • Docker
        • Dockerfile Best Practices
        • Docker Compose
      • Kubernetes
        • CLI Tools - Essential command-line utilities
          • Kubectl
          • Kubens
          • Kubectx
        • Core Concepts
        • Components
        • Best Practices
          • Pod Security
          • Security Monitoring
          • Resource Limits
        • Advanced Features - Beyond the basics [ADVANCED]
          • Service Mesh
            • Istio
            • Linkerd
          • Ingress Controllers
            • NGINX
            • Traefik
            • Kong
            • Gloo Edge
            • Contour
        • Tips
          • Status in Pods
          • Resource handling
          • Pod Troubleshooting Commands
        • Enterprise Architecture
        • Health Management
        • Security & Compliance
        • Virtual Clusters
      • OpenShift
  • Service Mesh & Networking
    • Service Mesh Implementation
  • Architecture Patterns
    • Data Mesh
    • Multi-Cloud Networking
    • Disaster Recovery
    • Chaos Engineering
  • Edge Computing
    • Implementation Guide
      • Serverless Edge
      • IoT Edge Patterns
      • Real-Time Processing
      • Edge AI/ML
      • Security Hardening
      • Observability Patterns
      • Network Optimization
      • Storage Patterns
  • ๐Ÿ”„CI/CD & GitOps
    • CI/CD Overview
      • Continuous Integration
      • Continuous Delivery
        • Deployment Strategies
        • Secrets Management
        • Blue-Green Deployments
        • Deployment Metrics
        • Progressive Delivery
        • Release Management for DevOps/SRE (2025)
      • CI/CD Platforms - Tool selection and implementation
        • Azure DevOps
          • Pipelines
            • Stages
            • Jobs
            • Steps
            • Templates - Reusable pipeline components
            • Extends
            • Service Connections - External service authentication
            • Best Practices for 2025
            • Agents and Runners
            • Third-Party Integrations
            • Azure DevOps CLI
          • Boards & Work Items
        • GitHub Actions
        • GitLab
          • GitLab Runner
          • Real-life scenarios
          • Installation guides
          • Pros and Cons
          • Comparison with alternatives
      • GitOps
        • Modern GitOps Practices
        • GitOps Patterns for Multi-Cloud (2025)
        • Flux
          • Overview
          • Progressive Delivery
          • Use GitOps with Flux, GitHub and AKS
  • Source Control
    • Source Control Overview
      • Git Branching Strategies
      • Component Versioning
      • Kubernetes Manifest Versioning
      • GitLab
      • Creating a Fork
      • Naming Branches
      • Pull Requests
      • Integrating LLMs into Source Control Workflows
  • โ˜๏ธCloud Platforms
    • Cloud Strategy
      • AWS to Azure
      • Azure to AWS
      • GCP to Azure
      • AWS to GCP
      • GCP to AWS
    • Azure
      • Best Practices
        • Azure Best Practices Overview
        • Azure Architecture Best Practices
        • Azure Naming Standards
        • Azure Tags
        • Azure Security Best Practices
      • Landing Zones
      • Services
        • Azure Active Directory (AAD)
        • Azure Monitor
        • Azure Key Vault
        • Azure Service Bus
        • Azure DNS
        • Azure App Service
        • Azure Batch
        • Azure Machine Learning
        • Azure OpenAI Service
        • Azure Cognitive Services
        • Azure Kubernetes Service (AKS)
        • Azure Databricks
        • Azure SQL Database
      • Monitoring
      • Administration Tools - Platform management interfaces
        • Azure PowerShell
        • Azure CLI
      • Tips & Tricks
    • AWS
      • Authentication
      • Best Practices
      • Tips & Tricks
      • Services
        • AWS IAM (Identity and Access Management)
        • Amazon CloudWatch
        • Amazon SNS (Simple Notification Service)
        • Amazon SQS (Simple Queue Service)
        • Amazon Route 53
        • AWS Elastic Beanstalk
        • AWS Batch
        • Amazon SageMaker
        • Amazon Bedrock
        • Amazon Comprehend
    • Google Cloud
      • Services
        • Cloud CDN
        • Cloud DNS
        • Cloud Load Balancing
        • Google Kubernetes Engine (GKE)
        • Cloud Run
        • Artifact Registry
        • Compute Engine
        • Cloud Functions
        • App Engine
        • Cloud Storage
        • Persistent Disk
        • Filestore
        • Cloud SQL
        • Cloud Spanner
        • Firestore
        • Bigtable
        • BigQuery
        • VPC (Virtual Private Cloud)
  • ๐Ÿ”Security & Compliance
    • DevSecOps Overview
      • DevSecOps Pipeline Security
      • DevSecOps
        • Real-life Examples
        • Scanning & Protection - Automated security tooling
          • Dependency Scanning
          • Credential Scanning
          • Container Security Scanning
          • Static Code Analysis
            • Best Practices
            • Tool Integration Guide
            • Pipeline Configuration
        • CI/CD Security
        • Secrets Rotation
      • Supply Chain Security
        • SLSA Framework
        • Binary Authorization
        • Artifact Signing
      • Security Best Practices
        • Threat Modeling
        • Kubernetes Security
      • SecOps
      • Zero Trust Model
      • Cloud Compliance
        • ISO/IEC 27001:2022
        • ISO 22301:2019
        • PCI DSS
        • CSA STAR
      • Security Frameworks
      • SIEM and SOAR
  • Security Architecture
    • Zero Trust Implementation
      • Identity Management
      • Network Security
      • Access Control
  • ๐Ÿ”Observability & Monitoring
    • Observability Fundamentals
      • Logging
      • Metrics
      • Tracing
      • Dashboards
      • SLOs and SLAs
      • Observability as Code
      • Pipeline Observability
  • ๐ŸงชTesting Strategies
    • Testing Overview
      • Modern Testing Approaches
      • End-to-End Testing
      • Unit Testing
      • Performance Testing
        • Load Testing
      • Fault Injection Testing
      • Integration Testing
      • Smoke Testing
  • ๐Ÿค–AI Integration
    • AIops Overview
      • Workflow Automation
      • Predictive Analytics
      • Code Quality
  • ๐Ÿง AI & LLM Integration
    • Overview
      • Claude
        • Installation Guide
        • Project Guides
        • MCP Server Setup
        • LLM Comparison
      • Ollama
        • Installation Guide
        • Configuration
        • Models and Fine-tuning
        • DevOps Usage
        • Docker Setup
        • GPU Setup
        • Open WebUI
      • Copilot
        • Installation Guide
        • VS Code Integration
        • CLI Usage
      • Gemini
        • Installation Guides - Platform-specific setup
          • Linux Installation
          • WSL Installation
          • NixOS Installation
        • Gemini 2.5 Features
        • Roles and Agents
        • NotebookML Guide
        • Cloud Infrastructure Deployment
        • Summary
  • ๐Ÿ’ปDevelopment Environment
    • DevOps Tools
      • Operating Systems - Development platforms
        • NixOS
          • Install NixOS: PC, Mac, WSL
          • Nix Language Deep Dive
          • Nix Language Fundamentals
            • Nix Functions and Techniques
            • Building Packages with Nix
            • NixOS Configuration Patterns
            • Flakes: The Future of Nix
          • NixOS Generators: Azure & QEMU
        • WSL2
          • Distributions
          • Terminal Setup
      • Editor Environments
      • CLI Tools
        • Azure CLI
        • PowerShell
        • Linux Commands
          • SSH - Secure Shell)
            • SSH Config
            • SSH Port Forwarding
        • Linux Fundametals
        • Cloud init
          • Cloud init examples
        • YAML Tools
          • How to create a k8s yaml file - How to create YAML config
          • YQ the tool
  • ๐Ÿ“šProgramming Languages
    • Python
    • Go
    • JavaScript/TypeScript
    • Java
    • Rust
  • Platform Engineering
    • Implementation Guide
  • FinOps
    • Implementation Guide
  • AIOps
    • LLMOps Guide
  • Should Learn
    • Should Learn
    • Linux
      • Commands
      • OS
      • Services
    • Terraform
    • Getting Started - Installation and initial setup [BEGINNER]
    • Cloud Integrations
    • Testing and Validation - Ensuring infrastructure quality
      • Unit Testing
      • Integration Testing
      • End-to-End Testing
      • Terratest Guide
    • Best Practices - Production-ready implementation strategies
      • State Management
      • Security
      • Code Organization
      • Performance
    • Tools & Utilities
    • CI/CD Integration
    • Bicep
    • Kubernetes
      • kubectl
    • Ansible
    • Puppet
    • Java
    • Rust
    • Azure CLI
  • ๐Ÿ“–Documentation Best Practices
    • Documentation Strategy
      • Project Documentation
      • Release Notes
      • Static Sites
      • Documentation Templates
      • Real-World Examples
  • ๐Ÿ“‹Reference Materials
    • Glossary
    • Tool Comparison
    • Tool Decision Guides
    • Recommended Reading
    • Troubleshooting Guide
    • Development Setup
Powered by GitBook
On this page
  • Why Integration Testing
  • Integration Testing Design Blocks
  • Applying Integration Testing
  • Cloud-Native Integration Testing
  • LLM-Assisted Integration Testing
  • Integration Testing Frameworks and Tools
  • Best Practices for Modern Integration Testing
  • Conclusion
Edit on GitHub
  1. Testing Strategies
  2. Testing Overview

Integration Testing

PreviousFault Injection TestingNextSmoke Testing

Last updated 5 days ago

Integration testing is a software testing methodology used to determine how well individually developed components, or modules of a system communicate with each other. This method of testing confirms that an aggregate of a system, or sub-system, works together correctly or otherwise exposes erroneous behavior between two or more units of code.

Why Integration Testing

Because one component of a system may be developed independently or in isolation of another it is important to verify the interaction of some or all components. A complex system may be composed of databases, APIs, interfaces, and more, that all interact with each other or additional external systems. Integration tests expose system-level issues such as broken database schemas or faulty third-party API integration. It ensures higher test coverage and serves as an important feedback loop throughout development.

Integration Testing Design Blocks

Consider a banking application with three modules: login, transfers, and current balance, all developed independently. An integration test may verify when a user logs in they are re-directed to their current balance with the correct amount for the specific mock user. Another integration test may perform a transfer of a specified amount of money. The test may confirm there are sufficient funds in the account to perform the transfer, and after the transfer the current balance is updated appropriately for the mock user. The login page may be mocked with a test user and mock credentials if this module is not completed when testing the transfers module.

Integration testing is done by the developer or QA tester. In the past, integration testing always happened after unit and before system and E2E testing. Compared to unit-tests, integration tests are fewer in quantity, usually run slower, and are more expensive to set up and develop. Now, if a team is following agile principles, integration tests can be performed before or after unit tests, early and often, as there is no need to wait for sequential processes. Additionally, integration tests can utilize mock data in order to simulate a complete system. There is an abundance of language-specific testing frameworks that can be used throughout the entire development lifecycle.

** It is important to note the difference between integration and acceptance testing. Integration testing confirms a group of components work together as intended from a technical perspective, while acceptance testing confirms a group of components work together as intended from a business scenario.

Applying Integration Testing

Prior to writing integration tests, the engineers must identify the different components of the system, and their intended behaviors and inputs and outputs. The architecture of the project must be fully documented or specified somewhere that can be readily referenced (e.g., the architecture diagram).

There are two main techniques for integration testing.

Big Bang

Big Bang integration testing is when all components are tested as a single unit. This is best for small system as a system too large may be difficult to localize for potential errors from failed tests. This approach also requires all components in the system under test to be completed which may delay when testing begins.

Big Bang Integration Testing

Incremental Testing

Incremental testing is when two or more components that are logically related are tested as a unit. After testing the unit, additional components are combined and tested all together. This process repeats until all necessary components are tested.

Top Down

Top down testing is when higher level components are tested following the control flow of a software system. In the scenario, what is commonly referred to as stubs are used to emulate the behavior of lower level modules not yet complete or merged in the integration test.

Bottom Up

Bottom up testing is when lower level modules are tested together. In the scenario, what is commonly referred to as drivers are used to emulate the behavior of higher level modules not yet complete or included in the integration test.

A third approach known as the sandwich or hybrid model combines the bottom up and town down approaches to test lower and higher level components at the same time.

Things to Avoid

There is a tradeoff a developer must make between integration test code coverage and engineering cycles. With mock dependencies, test data, and multiple environments at test, too many integration tests are infeasible to maintain and become increasingly less meaningful. Too much mocking will slow down the test suite, make scaling difficult, and may be a sign the developer should consider other tests for the scenario such as acceptance or E2E.

Integration tests of complex systems require high maintenance. Avoid testing business logic in integration tests by keeping test suites separate. Do not test beyond the acceptance criteria of the task and be sure to clean up any resources created for a given test. Additionally, avoid writing tests in a production environment. Instead, write them in a scaled-down copy environment.

Cloud-Native Integration Testing

Modern cloud-native architectures bring new challenges and opportunities for integration testing. Distributed systems with multiple microservices, databases, message brokers, and third-party services require specialized testing approaches.

Container-Based Integration Testing

Containers provide isolated, reproducible environments which are ideal for integration testing. Tools like Docker Compose and Testcontainers allow you to create temporary test environments with all your dependencies.

Docker Compose Example

# integration-test-stack.yml
version: '3'
services:
  app:
    build: .
    depends_on:
      - db
      - redis
    environment:
      - DB_HOST=db
      - REDIS_HOST=redis
      - TEST_MODE=true
  
  db:
    image: postgres:13
    environment:
      - POSTGRES_PASSWORD=test
      - POSTGRES_USER=test
      - POSTGRES_DB=testdb
    volumes:
      - ./init-scripts:/docker-entrypoint-initdb.d
  
  redis:
    image: redis:6

Testcontainers Example (Java)

@Testcontainers
public class OrderServiceIntegrationTest {
    @Container
    private static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:13")
            .withDatabaseName("orders")
            .withUsername("test")
            .withPassword("test");
            
    @Container
    private static final GenericContainer<?> redis = new GenericContainer<>("redis:6")
            .withExposedPorts(6379);
            
    @BeforeAll
    static void setup() {
        System.setProperty("spring.datasource.url", postgres.getJdbcUrl());
        System.setProperty("spring.datasource.username", postgres.getUsername());
        System.setProperty("spring.datasource.password", postgres.getPassword());
        System.setProperty("spring.redis.host", redis.getHost());
        System.setProperty("spring.redis.port", redis.getFirstMappedPort().toString());
    }
    
    @Test
    void testOrderCreation() {
        // Test interaction between order service, database and cache
    }
}

Kubernetes-Based Integration Testing

For systems deployed on Kubernetes, integration tests can be run directly on ephemeral test clusters.

K3d Example (Local Kubernetes)

#!/bin/bash

# Create temporary test cluster
k3d cluster create test-cluster --agents 1

# Deploy test dependencies
kubectl apply -f ./test-resources/

# Wait for resources to be ready
kubectl wait --for=condition=ready pod -l app=database --timeout=60s
kubectl wait --for=condition=ready pod -l app=message-broker --timeout=60s

# Run integration tests
./gradlew integrationTest

# Cleanup
k3d cluster delete test-cluster

GitHub Actions Example

name: Integration Tests

on: [push, pull_request]

jobs:
  integration-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Set up Kind cluster
        uses: helm/kind-action@v1.5.0
        
      - name: Deploy test infrastructure
        run: |
          kubectl apply -f ./k8s/test-infra/
          kubectl wait --for=condition=ready pod -l app=test-db --timeout=90s
          
      - name: Run integration tests
        run: ./mvnw verify -Pintegration-tests

Cloud Provider Testing

Each major cloud provider offers services that can be leveraged for integration testing with their specific services.

AWS Integration Testing

# Test infrastructure using LocalStack for AWS service mocking
resource "aws_s3_bucket" "test_bucket" {
  bucket = "integration-test-bucket"
  # Use LocalStack endpoint for integration testing
  provider = aws.localstack
}

resource "aws_sqs_queue" "test_queue" {
  name = "integration-test-queue"
  provider = aws.localstack
}

# Test event flow: S3 โ†’ Lambda โ†’ SQS
resource "aws_lambda_function" "test_processor" {
  function_name = "test-processor"
  handler = "index.handler"
  runtime = "nodejs14.x"
  filename = "./test-artifacts/function.zip"
  provider = aws.localstack
}

Azure Integration Testing Example

# azure-pipelines.yml
jobs:
  - job: IntegrationTests
    pool:
      vmImage: 'ubuntu-latest'
    steps:
      - task: AzureResourceManagerTemplateDeployment@3
        inputs:
          deploymentScope: 'Resource Group'
          azureResourceManagerConnection: 'test-service-connection'
          subscriptionId: '$(TEST_SUBSCRIPTION_ID)'
          resourceGroupName: 'integration-tests-rg'
          location: 'East US'
          templateLocation: 'Linked artifact'
          csmFile: './arm/test-resources.json'
          overrideParameters: '-environment test'
          deploymentMode: 'Incremental'
          
      - script: |
          go test ./integration -v -tags=integration
        displayName: 'Run integration tests'
        
      - task: AzureCLI@2
        inputs:
          azureSubscription: 'test-service-connection'
          scriptType: 'bash'
          scriptLocation: 'inlineScript'
          inlineScript: |
            az group delete -n integration-tests-rg --yes --no-wait

LLM-Assisted Integration Testing

Large Language Models (LLMs) can enhance integration testing in several ways:

Test Scenario Generation

LLMs can analyze system architecture diagrams and API documentation to generate comprehensive test scenarios:

import openai

def generate_integration_test_scenarios(system_description, api_specs):
    """Generate integration test scenarios using OpenAI's API."""
    prompt = f"""
    Based on the following system description and API specifications, 
    generate 5 detailed integration test scenarios that cover critical paths.
    For each scenario, include:
    1. Test name and description
    2. Components involved
    3. Preconditions
    4. Test steps
    5. Expected results
    6. Potential edge cases to consider
    
    System description:
    {system_description}
    
    API specifications:
    {api_specs}
    """
    
    response = openai.ChatCompletion.create(
        model="gpt-4",
        messages=[
            {"role": "system", "content": "You are a senior QA engineer specializing in integration testing."},
            {"role": "user", "content": prompt}
        ]
    )
    
    return response.choices[0].message['content']

# Example usage
system_desc = """
Our payment processing system has three microservices:
1. PaymentGateway - Handles payment requests and routes to processors
2. FraudDetection - Analyzes transactions for fraudulent patterns
3. NotificationService - Sends confirmations to customers
"""

api_specs = """
PaymentGateway API:
- POST /payments: Create new payment
- GET /payments/{id}: Get payment status

FraudDetection API:
- POST /analyze: Check transaction for fraud indicators

NotificationService API:
- POST /notify: Send notification to customer
"""

test_scenarios = generate_integration_test_scenarios(system_desc, api_specs)
print(test_scenarios)

Mocking Response Generation

LLMs can help generate realistic mock responses for external services, especially useful for third-party APIs:

// Example: using OpenAI to generate realistic mock data for tests
const { OpenAI } = require('openai');

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY
});

async function generateMockResponse(serviceType, requestParams) {
  const prompt = `
    Generate a realistic JSON mock response for a ${serviceType} API with these request parameters:
    ${JSON.stringify(requestParams, null, 2)}
    
    The response should follow typical patterns for this type of service and include any
    normally expected fields.
  `;
  
  const response = await openai.chat.completions.create({
    model: "gpt-4",
    messages: [
      { role: "system", content: "You are a helpful API simulation tool. Respond only with valid JSON." },
      { role: "user", content: prompt }
    ],
    temperature: 0.7,
  });
  
  return JSON.parse(response.choices[0].message.content);
}

module.exports = { generateMockResponse };

Integration Testing Frameworks and Tools

Many tools and frameworks can be used to write both unit and integration tests. The following tools are for automating integration tests.

General Testing Frameworks

Cloud and Container Testing Tools

CI/CD Integration

Best Practices for Modern Integration Testing

  1. Infrastructure as Code (IaC) - Define test environments using IaC tools like Terraform or CloudFormation to ensure consistency.

  2. Ephemeral Environments - Create and destroy test environments for each test run to ensure isolated and clean conditions.

  3. Service Virtualization - Use mocks, stubs, and service virtualization to isolate the components being tested.

  4. Observability Integration - Collect metrics, logs, and traces during integration tests to better understand system behavior.

  5. Test Data Management - Use data generation tools or sanitized production data to create realistic test scenarios.

  6. Shift-Left Security - Include security validations in integration tests to catch vulnerabilities early.

  7. Parallel Test Execution - Run integration tests in parallel to reduce overall test execution time.

  8. Feature Flags - Use feature flags to isolate new functionality in tests before full deployment.

Conclusion

Integration testing demonstrates how one module of a system, or external system, interfaces with another. This can be a test of two components, a sub-system, a whole system, or a collection of systems. Tests should be written frequently and throughout the entire development lifecycle using an appropriate amount of mocked dependencies and test data. Because integration tests prove that independently developed modules interface as technically designed, it increases confidence in the development cycle providing a path for a system that deploys and scales.

In the modern cloud-native landscape, integration testing has evolved to encompass containerization, orchestration, and distributed systems concepts. By leveraging tools specific to cloud environments and implementing automated testing pipelines, teams can ensure their interconnected components work seamlessly together, even in complex multi-service architectures.

Top Down Integration Testing
Bottom Up Integration Testing

- Library to run Docker containers for testing

- Mocked AWS services for testing

- Azure Storage emulator

- Testing tool for Terraform infrastructure

and - Lightweight Kubernetes clusters for testing

- Mock AWS services in Python tests

- Contract testing for microservices

- Workflow automation for GitHub

- Self-hosted automation server

- Cloud-based CI/CD platform

- GitLab's integrated CI/CD

๐Ÿงช
JUnit
Robot Framework
moq
Cucumber
Selenium
Behave (Python)
Testcontainers
LocalStack
Azurite
Terratest
K3d
Kind
Moto
Pact
GitHub Actions
Jenkins
CircleCI
GitLab CI
Azure Pipelines