From ab426f928fd5408606ca1234dbfd2a8264f61a77 Mon Sep 17 00:00:00 2001 From: Swapnoneel Saha Date: Tue, 17 Sep 2024 01:12:45 +0530 Subject: [PATCH 1/4] updated slack url Signed-off-by: Swapnoneel Saha --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 987b85570..e17f4989b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Repository for the Keploy documentation website. - + From e32dfa32f0209f6512eaf992d0066d8d9eb814af Mon Sep 17 00:00:00 2001 From: Swapnoneel Saha Date: Fri, 18 Oct 2024 17:51:58 +0530 Subject: [PATCH 2/4] updated the faq section Signed-off-by: Swapnoneel Saha --- .../version-2.0.0/keploy-explained/faq.md | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/versioned_docs/version-2.0.0/keploy-explained/faq.md b/versioned_docs/version-2.0.0/keploy-explained/faq.md index b8522e0e1..d37749ce4 100644 --- a/versioned_docs/version-2.0.0/keploy-explained/faq.md +++ b/versioned_docs/version-2.0.0/keploy-explained/faq.md @@ -9,43 +9,56 @@ tags: Let's get to the heart of Keploy with some fun Q&A! -### 1. Is Keploy a unit testing framework? +### 1. What is Keploy? -Nope, doesn't replace your trusty unit testing frameworks like `go-test`, `JUnit`, `Pytest`, or `Jest`. Instead, it teams up with them to make your testing life a breeze, ensuring compatibility with your favorite tools and pipelines. +Keploy is an open-source testing platform designed to automatically generate test cases from existing API traffic. It allows users to record, replay, and compare API interactions, making it easier to write and maintain test suites. -### 2. Does Keploy replace unit tests entirely? +### 2. How does Keploy work? -Almost! Keploy aims to save you a whopping 80% of the testing effort. While it handles most cases, you might still want to write tests for some methods that aren't API-invokable. +Keploy works by recording incoming API calls during normal operations. It then replays these interactions in a test environment and compares the results to the initial responses to detect regressions or unexpected behavior in the code. -### 3. What code changes do I need to do? +### 3. Does Keploy support mocking? -Zero, zip, nada! For `Golang`, `Java`, `Python`, and `JavaScript` applications, Keploy plays nice with your existing codebase, requiring no code changes. +Yes, Keploy allows mocking external dependencies like databases and third-party services during test execution to ensure that tests run in isolation without relying on external systems. -### 4. How do I run keploy in my CI pipeline? +### 4. What are the prerequisites for using Keploy? -Simple as pie. No need to overhaul your CI pipeline; you can keep using the one that runs your unit tests. Keploy fits right in! +To use Keploy, you need: -### 5. Does Keploy support read after write to DB scenarios? +- A service or application that exposes APIs (e.g., REST or GraphQL). +- Keploy supports programming languages like Go, Node.js, Python, and Java, so the appropriate SDK for your environment should be installed. -Absolutely! Keploy keeps things in order, recording write and read requests in sequence. It expects your application to play by the rules and serves up the same database responses as it did during capture. +### 5. Is Keploy suitable for microservices architecture? -### 6. How does keploy handle fields like timestamps, random numbers (eg: uuids)? +Yes, Keploy is designed to work in microservices-based environments. It can record and replay API calls across services, making it ideal for testing distributed systems. -Keploy's got a keen eye for detail. If a request passes its deduplication algorithm, it's game time. Keploy sends a second request with the same parameters to check for differences in responses. Fields like timestamps and UUIDs get the spotlight as they're automatically flagged for comparison. From then on, they're out of the testing picture. +### 6. Does Keploy require code changes to integrate? -### 7. Can I use keploy to generate tests from production environments automatically? +Keploy can be integrated without any changes to the application code. However, adding Keploy SDKs may offer more fine-grained control for specific use cases. -Not just yet, but we're on it! We're cooking up a scalable deduplication algorithm to make it safe for production. If you're itching to explore this frontier, come chat with us on Slack. We'd love to join forces and put our system to the test with your systems. +### 7. Can Keploy help with CI/CD pipelines? -### 8. What if my application behaviour changes? +Yes, Keploy integrates with CI/CD pipelines to run automated tests on every commit or code change. This ensures that any regressions are detected early in the development process. -Change is the only constant in the tech world, right? If your app decides to switch things up, your test cases might break. No worries; you can mark the new behavior as normal. +### 8. Is Keploy scalable for large projects? -Got more questions? We're all ears (and code)👂. +Keploy is designed to be scalable. It can handle high traffic volumes and complex services in large-scale distributed systems. It is efficient for generating and managing test cases across services. - +Yes, Keploy can be used to test legacy systems, especially if they expose APIs. It can record traffic and replay calls without needing to modify the legacy codebase. + +### 10. Can Keploy be used with databases? + +Yes, Keploy can mock database responses during test replay. This helps isolate tests and ensures consistency during test execution. + +### 11. Is Keploy free to use? + +Yes, Keploy is open-source and free to use under the Apache 2.0 license. You can also contribute to its development on GitHub. + +### 12. Can I customize Keploy's behavior for specific APIs? + +Yes, Keploy provides configuration options to customize recording, replay, and comparison logic for specific APIs, giving users control over how their APIs are tested. Hope this helps you out, if you still have any questions, reach out to us . From 4087e0d9abc900db633c1974db2963a431d1d056 Mon Sep 17 00:00:00 2001 From: Swapnoneel Saha Date: Fri, 18 Oct 2024 18:11:23 +0530 Subject: [PATCH 3/4] added common errors section Signed-off-by: Swapnoneel Saha --- sidebars.js | 1 + .../keploy-explained/common-errors.md | 193 ++++++++++++++++++ .../version-2.0.0-sidebars.json | 3 +- 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 versioned_docs/version-2.0.0/keploy-explained/common-errors.md diff --git a/sidebars.js b/sidebars.js index bc95d6fcd..ca2aa8b38 100644 --- a/sidebars.js +++ b/sidebars.js @@ -11,6 +11,7 @@ module.exports = { "keploy-explained/how-keploy-works", "keploy-explained/why-keploy", "keploy-explained/faq", + "keploy-explained/common-errors", ], }, { diff --git a/versioned_docs/version-2.0.0/keploy-explained/common-errors.md b/versioned_docs/version-2.0.0/keploy-explained/common-errors.md new file mode 100644 index 000000000..fe39776be --- /dev/null +++ b/versioned_docs/version-2.0.0/keploy-explained/common-errors.md @@ -0,0 +1,193 @@ +--- +id: common-errors +title: Common Errors in Keploy +sidebar_label: Common Errors +tags: + - explanation + - faq +--- + +Let's check some of the common errors that you might encounter while working with Keploy! + +### 1. Dependency Not Found Error + +#### Description: + +This error occurs when Keploy is unable to find or access a required dependency, like a database or external service. + +#### Possible Cause: + +- The dependency may not be running or is incorrectly configured. +- Networking issues may be preventing Keploy from connecting to external dependencies. + +#### Solution: + +- Ensure that all necessary services (e.g., databases, third-party APIs) are running. +- Check your environment variables or config files for the correct host and port details. + +### 2. Unable to Record API Calls + +#### Description: + +Keploy fails to record incoming API traffic, meaning no tests are generated. + +#### Possible Cause: + +- Incorrect integration with the application. +- Keploy may not be correctly started with the application, or the SDK is not configured properly. +- The application may not be making API calls that are recognizable by Keploy. + +#### Solution: + +- Double-check the integration guide for the programming language you’re using. +- Ensure that Keploy is properly hooked into the API layer. +- Check Keploy logs for any missed or skipped requests. + +### 3. Test Replay Failure + +#### Description: + +Keploy is unable to replay recorded API requests. + +#### Possible Cause: + +- External services or databases may be in a different state than they were during recording. +- Non-deterministic values like timestamps, UUIDs, or random values are causing failures. + +#### Solution: + +- Use Keploy’s mocking features to mock external services and databases. +- Exclude or handle non-deterministic values using Keploy’s configuration to ensure stable comparisons. + +### 4. Response Mismatch Error + +#### Description: + +When Keploy replays API calls, it detects a mismatch between the recorded response and the current response. + +#### Possible Cause: + +- The application’s behavior has changed, leading to different responses. +- Changes in the response format, status codes, or headers that weren’t present during recording. + +#### Solution: + +- Review the application changes and determine if the mismatch is expected (e.g., new features). +- If the change is acceptable, update the test baseline to reflect the new behavior. +- Use Keploy’s flexible comparison options to ignore certain fields or values (like timestamps or version numbers). + +### 5. Incorrect Test Generation + +#### Description: + +Keploy generates tests that don’t properly reflect the API interactions. + +#### Possible Cause: + +- The API interaction may be too complex or involve custom logic that Keploy cannot automatically handle. +- API parameters may be missing or misinterpreted during recording. + +#### Solution: + +- Review the recorded test cases for correctness. +- Manually adjust the generated tests to include missing or misinterpreted parameters. +- Make use of Keploy’s API to refine the recording process if necessary. + +### 6. Database Connection Error during Test Replay + +#### Description: + +Keploy cannot connect to the database or other external systems during the replay of tests. + +#### Possible Cause: + +- The test environment may not have access to the same database as the original recording. +- Database credentials or host information could be incorrect or missing in the test environment. + +#### Solution: + +- Ensure that the test environment mirrors the configuration used during recording. +- Use database mocks or stubs if testing in isolation from the database is desired. + +### 7. Missing or Invalid Configuration Error + +#### Description: + +Keploy cannot find a valid configuration file or encounters errors in the configuration. + +#### Possible Cause: + +- The Keploy configuration file (keploy.yaml or similar) is missing or contains invalid values. +- Environment variables required by Keploy may not be set. + +#### Solution: + +- Double-check the configuration file format and ensure all required fields are populated. +- Verify that environment variables (like API keys, URLs) are correctly set and accessible. + +### 8. Timeout Errors + +#### Description: + +Keploy times out while recording or replaying API calls. + +#### Possible Cause: + +- Long-running API requests or slow external dependencies can cause timeout issues. +- Keploy may have low timeout settings for API calls. + +#### Solution: + +- Increase the timeout settings in Keploy’s configuration. +- Investigate slow-performing services or optimize the API to reduce request time. + +### 9. Insufficient Permissions + +#### Description: + +Keploy fails due to insufficient permissions when accessing files, networks, or other resources. + +#### Possible Cause: + +The user or service running Keploy may not have sufficient permissions to access resources like databases, APIs, or file systems. + +#### Solution: + +- Ensure that the user or service running Keploy has the necessary permissions. +- Review system permissions and provide the required access rights for Keploy to function properly. + +### 10. Version Compatibility Issues + +#### Description: + +Errors occur because of version mismatches between Keploy, its dependencies, or the application it’s testing. + +#### Possible Cause: + +- Using incompatible versions of Keploy or related SDKs with your application. +- Dependencies of Keploy (e.g., for mocking or replaying) may have updated and broken compatibility. + +#### Solution: + +- Ensure that all components, including Keploy and its SDKs, are compatible with each other. +- Consult the Keploy documentation or release notes for any breaking changes in recent versions. + +### 11. Unsupported Protocol or API + +#### Description: + +Keploy does not support the protocol or API structure you are using (e.g., gRPC, SOAP, etc.). + +#### Possible Cause: + +- The application might use an API or protocol that Keploy doesn’t yet support (e.g., WebSocket, gRPC). + +#### Solution: + +- Confirm that your API format is supported. Keploy currently supports HTTP/REST and GraphQL. For unsupported APIs, you may need to use alternative testing tools or frameworks. + +Hope this helps you out, if you are still facing any issues, please feel free to reach out to us . + +import GetSupport from '../concepts/support.md' + + diff --git a/versioned_sidebars/version-2.0.0-sidebars.json b/versioned_sidebars/version-2.0.0-sidebars.json index a602fba3d..eeb3b3c20 100644 --- a/versioned_sidebars/version-2.0.0-sidebars.json +++ b/versioned_sidebars/version-2.0.0-sidebars.json @@ -164,7 +164,8 @@ "dependencies/postgres", "dependencies/http", "dependencies/redis", - "keploy-explained/faq" + "keploy-explained/faq", + "keploy-explained/common-errors" ] } ], From dd18d565914f47ad379ef4a020d24ee17e97e8a3 Mon Sep 17 00:00:00 2001 From: Swapnoneel Saha Date: Thu, 2 Jan 2025 15:27:18 +0530 Subject: [PATCH 4/4] added detailed text and images Signed-off-by: Swapnoneel Saha --- .../keploy-explained/common-errors.md | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/versioned_docs/version-2.0.0/keploy-explained/common-errors.md b/versioned_docs/version-2.0.0/keploy-explained/common-errors.md index fe39776be..e8fa350d5 100644 --- a/versioned_docs/version-2.0.0/keploy-explained/common-errors.md +++ b/versioned_docs/version-2.0.0/keploy-explained/common-errors.md @@ -9,11 +9,13 @@ tags: Let's check some of the common errors that you might encounter while working with Keploy! +[](https://camo.githubusercontent.com/74cbc79070c04e7077cfd86981c110678fe434e9269ea8f52eafb37b781cfb4a/68747470733a2f2f646f63732e6b65706c6f792e696f2f696d672f6b65706c6f792d6c6f676f2d6461726b2e7376673f733d32303026763d34) + ### 1. Dependency Not Found Error #### Description: -This error occurs when Keploy is unable to find or access a required dependency, like a database or external service. +This error occurs when Keploy cannot locate or access a required dependency, such as a database or external service. #### Possible Cause: @@ -22,8 +24,9 @@ This error occurs when Keploy is unable to find or access a required dependency, #### Solution: -- Ensure that all necessary services (e.g., databases, third-party APIs) are running. -- Check your environment variables or config files for the correct host and port details. +- Verify that all required services (e.g., databases, third-party APIs) are active and accessible. +- Check the environment variables or configuration files to confirm the correct host and port details. +- Use network diagnostic tools (e.g., ping, traceroute) to identify connectivity issues. ### 2. Unable to Record API Calls @@ -56,8 +59,9 @@ Keploy is unable to replay recorded API requests. #### Solution: -- Use Keploy’s mocking features to mock external services and databases. -- Exclude or handle non-deterministic values using Keploy’s configuration to ensure stable comparisons. +- Leverage Keploy’s mocking capabilities to simulate external services and databases. +- Use configurations to handle or exclude non-deterministic values for consistent comparisons. +- Regularly reset the database state to match the conditions during recording. ### 4. Response Mismatch Error @@ -106,8 +110,9 @@ Keploy cannot connect to the database or other external systems during the repla #### Solution: -- Ensure that the test environment mirrors the configuration used during recording. -- Use database mocks or stubs if testing in isolation from the database is desired. +- Mirror the test environment configuration with the recording setup. +- Use database mocks or stubs for isolated testing. +- Double-check connection strings, credentials, and database availability. ### 7. Missing or Invalid Configuration Error @@ -122,8 +127,9 @@ Keploy cannot find a valid configuration file or encounters errors in the config #### Solution: -- Double-check the configuration file format and ensure all required fields are populated. -- Verify that environment variables (like API keys, URLs) are correctly set and accessible. +- Ensure the configuration file exists and follows the correct format. +- Populate all required fields with valid values. +- Check that environment variables are properly set. ### 8. Timeout Errors @@ -138,8 +144,9 @@ Keploy times out while recording or replaying API calls. #### Solution: -- Increase the timeout settings in Keploy’s configuration. -- Investigate slow-performing services or optimize the API to reduce request time. +- Increase timeout settings in the Keploy configuration. +- Identify and optimize slow-performing APIs or dependencies. +- Use monitoring tools to analyze API performance. ### 9. Insufficient Permissions @@ -169,8 +176,9 @@ Errors occur because of version mismatches between Keploy, its dependencies, or #### Solution: -- Ensure that all components, including Keploy and its SDKs, are compatible with each other. -- Consult the Keploy documentation or release notes for any breaking changes in recent versions. +- Verify version compatibility for Keploy and its SDKs. +- Consult Keploy documentation or release notes for known issues. +- Use version pinning to maintain a stable environment. ### 11. Unsupported Protocol or API @@ -184,9 +192,10 @@ Keploy does not support the protocol or API structure you are using (e.g., gRPC, #### Solution: -- Confirm that your API format is supported. Keploy currently supports HTTP/REST and GraphQL. For unsupported APIs, you may need to use alternative testing tools or frameworks. +- Confirm the supported protocols (currently HTTP/REST and GraphQL). +- Consider alternative tools or frameworks for unsupported protocols. -Hope this helps you out, if you are still facing any issues, please feel free to reach out to us . +If you’re still encountering issues after trying these solutions, feel free to reach out to the Keploy team or consult the community forums for additional support. Happy testing! import GetSupport from '../concepts/support.md'