diff --git a/versioned_docs/version-4.0.0/concepts/reference/glossary/integration-testing.md b/versioned_docs/version-4.0.0/concepts/reference/glossary/integration-testing.md
index 5e262f40a..c4290fab1 100644
--- a/versioned_docs/version-4.0.0/concepts/reference/glossary/integration-testing.md
+++ b/versioned_docs/version-4.0.0/concepts/reference/glossary/integration-testing.md
@@ -1,158 +1,117 @@
---
id: integration-testing
-title: "Integration Testing: Types, Tools & Best Practices"
+title: "Integration Testing: Definition and Key Concepts"
sidebar_label: Integration Testing
-description: "Learn what integration testing is, explore top-down vs bottom-up approaches, and discover tools and best practices for testing module interactions."
+description: "Integration testing definition, key concepts like stubs, drivers and mocks, common challenges, and how Keploy generates integration tests and mocks from real traffic."
tags:
- explanation
keywords:
- - API
+ - integration testing
+ - integration testing definition
+ - stubs and drivers
+ - integration testing with Keploy
---
-### What is Integration Testing ?
+**Integration testing** is a level of software testing that checks whether separate components of an application work correctly together. Those components can be internal modules, APIs, databases, message queues, third-party services or microservices.
-Integration testing is a software testing process that combines individual software modules into larger subsystems or components to evaluate their interactions. It is conducted after unit testing and before system testing. The primary objective of integration testing is to detect defects that occur when different modules are integrated and interact.
+It runs after unit testing and before system testing. Where a unit test checks one function in isolation, an integration test checks what happens at the boundaries: whether data is passed correctly, whether contracts between components are respected, and whether one component handles errors from another.
-
+
-### Types of Integration Testing
+## Key points
-There are two main types of integration testing:
+- **What it checks:** data flow and communication between components, including how failures in one component are handled by another.
+- **When it runs:** after unit tests pass, and ideally on every pull request in CI.
+- **Typical bugs found:** mismatched field names or data types, broken API contracts, wrong database writes, timeouts and bad data between services.
-1. **Top-down integration testing**: This type of integration testing starts with the highest-level modules and then works down to the lower-level modules. It begins by testing the topmost modules, which are often the user interfaces or main control modules, and progressively integrates and tests the lower-level modules. Stubs are used to simulate the lower-level modules that are not yet integrated. This approach helps in early detection of major design flaws and ensures that the high-level functionality is tested first. However, it may require significant effort to create stubs and can be challenging if lower-level modules are complex or not well-defined.
+## Integration testing approaches at a glance
-2. **Bottom-up integration testing**: This type of integration testing starts with the lowest-level modules and then works up to the higher-level modules. It begins by testing the lowest-level modules, which are often the building blocks of the system, and progressively integrates and tests the higher-level modules. Drivers are used to simulate the higher-level modules that are not yet integrated. This approach helps in early detection of major design flaws and ensures that the low-level functionality is tested first. However, it may require significant effort to create drivers and can be challenging if higher-level modules are complex or not well-defined.
+| Approach | How it works | Needs |
+| --- | --- | --- |
+| Big bang | All modules are combined and tested at once | Nothing extra, but failures are hard to trace |
+| Top-down | Start with high-level modules, add lower ones step by step | Stubs for lower modules not yet ready |
+| Bottom-up | Start with low-level modules, add higher ones step by step | Drivers to call the modules under test |
+| Sandwich (hybrid) | Top-down and bottom-up at the same time | Both stubs and drivers |
-Both types of integration testing are essential for ensuring that all components of a software application work together correctly.
+
-
+For a full walkthrough of each approach with examples and a test plan template, read our complete [integration testing guide](https://keploy.io/blog/community/integration-testing-a-comprehensive-guide).
-### How to perform Integration Testing ?
+## Key building blocks
-Integration testing can be performed using a variety of techniques, including:
+- **Stubs:** simple stand-ins for modules that are called by the module under test. They return fixed responses so you can test before every dependency is built.
+- **Drivers:** simple stand-ins for modules that call the module under test. They send inputs and collect outputs.
+- **Mocks:** stand-ins for external services, such as a payment API or a database, that also let you check how they were called.
+- **Test harness:** the setup that starts components, loads test data, runs the tests and records results, usually inside a CI pipeline.
-1. **Stubs**: Stubs are dummy modules that are used to simulate the behaviour of other modules that are not yet ready. They act as placeholders for the actual modules, allowing developers to test the integration of different parts of the system without waiting for all components to be fully developed. Stubs typically return predefined responses to function calls, enabling the testing of higher-level modules in isolation.
-2. **Drivers**: Drivers are modules that are used to control the execution of other modules.
-3. **Test harnesses**: Test harnesses are frameworks that automate the execution of integration tests. They provide the necessary infrastructure to execute tests, manage test data, and record results. Test harnesses often include tools for setting up test environments, generating test cases, and simulating interactions between different modules. By automating these tasks, test harnesses help ensure consistent and repeatable testing processes, making it easier to identify and diagnose integration issues.
+## Common challenges of traditional integration testing
-### Challenges of Traditional Integration Testing Method
+**1. Complexity of systems.** Modern applications connect many modules, APIs and outside services, each with its own configuration and behaviour. Making sure every part passes data correctly to every other part takes a lot of test cases, and unexpected interactions often only show up once everything is wired together.
-1. **Complexity of Systems:**
+**2. Dependency management.** Components depend on shared libraries, APIs, databases and third-party services, each with its own version and configuration. A change in one dependency can ripple through several others, which makes integration failures hard to trace back to their cause.
- - It can be difficult to integrate different modules, parts, and outside services into complex software programs, requiring extensive testing techniques. The requirement to make sure that every component of the system handles data consistently and communicates effectively gives rise to this complexity. Furthermore, the dependencies, configurations, and functional properties of various modules may differ, which may lead to unexpected challenges during integration.
+**3. Test data management.** Integration tests need realistic data that stays consistent across every connected system. Creating that data by hand is slow, and keeping it in sync between development, staging and CI environments is even harder, which leads to false failures or false passes.
-2. **Dependency Management:**
+**4. Environment configuration.** Test environments have to look enough like production to be meaningful, while staying isolated enough to be safe. Small differences in configuration, secrets or network setup between environments are a common reason tests pass locally and fail in staging.
- - Managing dependencies between components and ensuring they function together harmoniously can be complex, especially in distributed systems. Dependencies can include shared libraries, APIs, databases, and third-party services. Each dependency may have its own versioning, configuration, and compatibility requirements, which can lead to conflicts and integration issues. It is additionally challenging to identify and fix issues when changes to one component have a ripple effect on others. To ensure that every component function as a whole, detailed documentation, version control, and automated testing are necessary for effective dependency management.
+**5. Timing and coordination.** When several teams build different components, they are rarely ready at the same time. Integration testing then waits on the slowest team, and shared test environments get out of sync as teams deploy different versions.
-3. **Data Management:**
+**6. Third-party integrations.** External APIs are outside your control. They can change without notice, apply rate limits, require authentication that is awkward to set up in tests, or simply be unavailable, which makes tests that call them slow and unreliable.
- - Handling realistic test data scenarios, ensuring data integrity, and maintaining consistency across different testing environments pose challenges in integration testing. Creating and managing test data that accurately reflects real-world scenarios can be time-consuming and complex. Additionally, ensuring that test data remains consistent across various environments (development, staging, production) is crucial to avoid discrepancies that could lead to false positives or negatives in test results. Furthermore, managing data versioning and synchronization between different modules and services adds another layer of complexity to the integration testing process.
+**7. Regression testing.** Every new feature or fix can break an integration that used to work. Keeping a regression suite that covers all integration points up to date takes continuous effort, and running it by hand quickly becomes too slow.
-4. **Environment Configuration:**
+**8. Scalability and performance.** Integrations that work for one request can fail under real load. Testing how connected components behave with high traffic, large data volumes and many concurrent calls needs extra tooling and planning beyond functional integration tests.
- - Configuring testing environments to accurately reflect production while providing necessary isolation for testing is time-consuming and error-prone. Ensuring that the test environment mirrors the production environment in terms of hardware, software, network configurations, and data can be challenging. Differences between environments can lead to discrepancies in test results, making it difficult to identify true integration issues. Additionally, maintaining multiple environments for different stages of testing (development, staging, production) requires significant resources and coordination. Properly managing environment variables, secrets, and configurations across these environments adds another layer of complexity.
+## How Keploy handles integration testing
-5. **Timing and Coordination:**
+Keploy takes a different route from hand-written integration tests. It records real API calls to your application, together with the responses from the databases and downstream services behind them, and turns them into test cases and mocks.
- - Coordinating testing efforts across multiple teams or development cycles and ensuring all components are ready for testing at the same time require effective communication and coordination. This challenge is compounded by varying schedules, priorities, and resource availability among teams. Misalignment in timelines can lead to delays and bottlenecks, impacting the overall project timeline. Additionally, synchronizing test environments and ensuring consistent configurations across different teams can be difficult. Effective use of project management tools, regular status meetings, and clear documentation are essential to mitigate these challenges.
+| Task | Traditional approach | With Keploy |
+| --- | --- | --- |
+| Writing test cases | Each request and assertion is scripted by hand | Test cases are generated from recorded API traffic |
+| Stubs and mocks | Written and maintained by hand | Generated automatically from recorded dependency calls |
+| Test data | Built and refreshed manually | Comes from real requests and responses |
+| Environment setup | Real dependencies must be running for every test run | Recorded mocks replace dependencies during replay |
+| Regression checks | Suite grows slowly and needs constant updates | Recorded tests are replayed on every change |
-6. **Testing Third-Party Integrations:**
+A typical flow looks like this:
- - Testing integration with third-party APIs, libraries, or services introduces complexity as teams have limited control over their behaviour and availability. These third-party components can change without notice, leading to unexpected failures. Additionally, rate limits, authentication issues, and network latency can further complicate testing. Ensuring compatibility with different versions and handling deprecated features also pose significant challenges.
+```bash
+# 1. Record real traffic while you use the app
+keploy record -c "node src/app.js"
-7. **Regression Testing:**
+# 2. Replay the recordings as integration tests
+keploy test -c "node src/app.js" --delay 10
+```
- - Managing regression testing across multiple integration points to ensure new features or changes do not introduce compatibility issues is challenging, especially in large systems. This involves verifying that existing functionalities continue to work as expected after modifications. The complexity increases with the number of integration points, as each point must be tested for potential side effects. Additionally, maintaining an up-to-date suite of regression tests can be resource-intensive, requiring continuous updates to test cases and test data to reflect the current state of the system. Automated regression testing tools can help, but they also require significant setup and maintenance efforts.
-
-8. **Scalability and Performance Testing:**
- - Testing the scalability and performance of integrated systems under various conditions and loads requires specialized tools and expertise, posing resource-intensive challenges. This involves simulating real-world usage patterns, peak loads, and stress conditions to ensure the system can handle high traffic and data volumes without degradation. Additionally, identifying performance bottlenecks, memory leaks, and concurrency issues requires in-depth analysis and profiling. Ensuring that the system scales efficiently with increasing load and maintains optimal performance across different environments adds another layer of complexity.
-
-Addressing these challenges requires careful planning, collaboration between development and testing teams, and the adoption of effective testing strategies and tools. This is where Keploy comes into the play.
-
-### Overcoming Integration Testing Challenges with Keploy
-
-1. **Complexity of Systems:**
-
- - Keploy simplifies integration testing with its user-friendly platform and automation capabilities. It streamlines the testing process, even in complex systems, by providing an intuitive interface for recording interactions and generating test cases.
-
-2. **Dependency Management:**
-
- - Keploy automates stub generation, eliminating the need for manual creation of stubs or mock objects, which can be time-consuming and error-prone. Instead, it generates realistic stubs based on recorded interactions during the testing process. By using recorded interactions to create stubs, Keploy ensures that the dependencies are accurately simulated, leading to more reliable and comprehensive integration tests.
-
-3. **Data Management:**
-
- - Keploy addresses the challenges of data management in integration testing through its advanced features and capabilities. It automates the process of generating test data, which eliminates the need for manual data creation and reduces the risk of human error. This ensures that test data is always available and consistent across different test runs.
-
-4. **Environment Configuration:**
-
- - Keploy addresses the challenge of environment configuration in integration testing through its native integration feature, which simplifies the setup process and accelerates testing. It seamlessly integrates with your development setups, allowing for quick and easy configuration without the need for extensive manual setup. This reduces the time and effort required to mirror production environments for testing purposes. It also provides a way to isolate test environments, ensuring that tests do not interfere with each other and that the testing environment accurately reflects production. This isolation helps maintain the integrity of test results.
-
-5. **Timing and Coordination:**
- - Keploy provides a centralized platform where test cases can be recorded, stored, and shared. This centralization ensures that all team members have access to the same set of test cases and stub configurations, improving coordination and consistency. It provides real-time feedback and reports on the integration tests, allowing teams to quickly identify and address issues, thus improving coordination and responsiveness.
-
-### Benefits of Integration Testing with Keploy
-
-Performing integration testing with Keploy AI offers numerous benefits:
-
-- **Early Defect Identification**: Identify defects early in the development lifecycle, reducing the risk of issues in later stages.
-- **Seamless Integration**: Ensure that different modules work together seamlessly, enhancing the overall quality of the software application.
-- **Enhanced Efficiency**: Streamline testing processes and improve productivity with Keploy AI's automation and intelligent features.
-
-With Keploy AI, performing integration testing has never been easier or more effective.
-
-### Keploy vs Traditional Methods
-
-| **Aspect** | **Traditional Method** | **With Keploy** |
-| ------------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
-| Stub Generation | Manual creation of stubs or mock objects. | Automated stub generation based on recorded interactions. |
-| Test Generation | Manual scripting of test cases based on predefined scenarios. | Automated test case generation from recorded interactions. |
-| Testing Scenarios | Limited coverage of edge cases and complex scenarios. | Simulates wide range of scenarios, including edge cases and error handling. |
-| Collaborative Development | Limited collaboration due to manual processes. | Facilitates collaboration with centralized platform for test recording and sharing. |
-| Continuous Improvement | Limited insights and analysis for optimization. | Provides detailed analytics and reporting for continuous improvement. |
-
-### Conclusion
-
-Integration testing is essential in software development, addressing challenges like system complexity, dependency management, data handling, environment configuration, and coordination. Keploy provides a robust solution to these challenges.
-
-By providing a user-friendly platform with automation capabilities, Keploy simplifies the integration testing process, even in complex systems. Its automated stub generation and smart test generation features streamline dependency management and data handling, ensuring comprehensive coverage and data integrity.
-
-Furthermore, Keploy's native integration seamlessly integrates with development setups, eliminating the need for complex environment configuration and accelerating testing. It also fosters collaboration between teams by providing a centralized platform for recording test cases and sharing stub configurations, simplifying coordination efforts.
-
-In conclusion, Keploy empowers development teams to overcome the challenges of integration testing effectively, enabling them to deliver high-quality software with confidence and efficiency.
+During replay, Keploy serves the recorded database and service responses, so the tests check how your application integrates with its dependencies without those dependencies having to be available. See [how Keploy works](/docs/keploy-explained/introduction/) for setup steps for your language and framework.
## Related Terms
-- [Unit Testing](/docs/concepts/reference/glossary/unit-testing/) — precedes integration testing in the pyramid.
-- [End-to-End Testing](/docs/concepts/reference/glossary/end-to-end-testing/) — follows integration testing across the full system.
-- [Component Testing](/docs/concepts/reference/glossary/component-testing/) — tests parts before they are integrated.
-- [Stubs](/docs/concepts/reference/glossary/stubs/) — simulate not-yet-ready modules during integration.
-- [Browse all testing terms](/docs/concepts/reference/glossary/) — the full Keploy glossary.
-
-### FAQs
-
-#### 1. What is the primary goal of integration testing?
-
-The primary goal of integration testing is to identify and resolve any defects that arise when different software modules are combined and interact with each other. This ensures that the integrated components function correctly as a whole.
+- [Unit Testing](/docs/concepts/reference/glossary/unit-testing/): precedes integration testing in the pyramid.
+- [End-to-End Testing](/docs/concepts/reference/glossary/end-to-end-testing/): follows integration testing across the full system.
+- [Component Testing](/docs/concepts/reference/glossary/component-testing/): tests parts before they are integrated.
+- [Stubs](/docs/concepts/reference/glossary/stubs/): simulate not-yet-ready modules during integration.
+- [Browse all testing terms](/docs/concepts/reference/glossary/): the full Keploy glossary.
-#### 2. How does Keploy simplify integration testing?
+## FAQs
-Keploy simplifies integration testing by automating stub generation, dynamically creating test cases from recorded interactions, and providing tools for error debugging and analysis. This reduces the manual effort required and ensures comprehensive test coverage. Keploy's intelligent automation, dynamic test generation, and collaborative features make integration testing more straightforward, efficient, and comprehensive.
+### What is the primary goal of integration testing?
-#### 3. What types of integration testing can be performed using Keploy?
+To find and fix defects that appear when different software modules are combined and interact with each other, so the integrated components work correctly as a whole.
-Keploy supports both top-down and bottom-up integration testing. It can simulate the behaviours of high-level and low-level modules through automated stub generation and dynamic test case creation. Additionally, Keploy facilitates hybrid integration testing, combining both approaches to ensure comprehensive coverage. This flexibility allows for thorough testing of complex systems, ensuring that all components interact seamlessly.
+### What is the difference between unit testing and integration testing?
-#### 4. How does Keploy handle dependencies between modules during integration testing?
+Unit testing checks one function or class in isolation, with its dependencies mocked. Integration testing checks that several components work together, using real or recorded dependencies.
-Keploy handles dependencies between modules during integration testing by automatically generating realistic stubs based on recorded interactions. This process eliminates the need for manual creation of stubs or mock objects, thereby simplifying dependency management.
+### What are stubs and drivers in integration testing?
-This approach simplifies dependency management and enhances the reliability of integration tests.
+A stub stands in for a lower-level module that the module under test calls. A driver stands in for a higher-level module that calls the module under test. Stubs are used in top-down testing and drivers in bottom-up testing.
-#### 5. Can Keploy be integrated with existing unit testing frameworks?
+### How does Keploy simplify integration testing?
-Yes, Keploy can be integrated with existing unit testing frameworks. It seamlessly integrates with popular frameworks such as JUnit (Java), NUnit (.NET), PHPUnit (PHP), PyTest (Python), Jasmine (JavaScript), and Selenium (web applications). This ensures compatibility with existing unit testing workflows and enhances the overall testing process.
+Keploy records real API calls and the responses from databases and other services, then turns them into test cases and mocks automatically. This removes most of the manual work of writing integration tests, building mocks and preparing test data.
-#### 6. What are the benefits of using Keploy for integration testing compared to traditional methods?
+### Can integration tests run in CI/CD?
-Keploy offers numerous benefits, including automated test case generation, simplified dependency management, enhanced testing efficiency, and improved collaboration between teams. It provides a user-friendly platform that streamlines the integration testing process, even in complex systems.
+Yes. Integration tests should run automatically on every pull request. Keploy tests can be replayed in CI pipelines such as [GitHub Actions](/docs/ci-cd/github/), [GitLab CI](/docs/ci-cd/gitlab/) and [Jenkins](/docs/ci-cd/jenkins/).