From cb075feb0ae6b8b06ee3d81e0b1ec28999a0ec8c Mon Sep 17 00:00:00 2001 From: Neha Gupta Date: Tue, 17 Jun 2025 17:07:36 +0530 Subject: [PATCH 1/4] chore: added v3 structure of docs Signed-off-by: Neha Gupta Signed-off-by: Soumyodeep-Das --- docusaurus.config.js | 63 ++-- src/components/Product.js | 255 ++++++++++++++++ src/components/QuickStart.js | 57 ++-- src/components/UtgMethods.js | 147 +++++++++ src/css/custom.css | 4 +- src/pages/index.js | 3 +- .../keploy-explained/ai-models.md | 40 +++ .../keploy-explained/api-testing-faq.md | 59 ++++ .../keploy-explained/how-keploy-works.md | 2 +- .../{faq.md => integration-testing-faq.md} | 8 +- .../keploy-explained/integrations-pr-agent.md | 29 ++ .../keploy-explained/integrations-vscode.md | 29 ++ .../keploy-explained/keploy-privacy.md | 33 ++ .../keploy-explained/keploy-security.md | 40 +++ .../keploy-explained/supported-languages.md | 50 ++++ .../keploy-explained/unit-testing-faq.md | 51 ++++ .../keploy-explained/utg-best-practices.md | 283 ++++++++++++++++++ .../quickstart/nextjs-postgres.md | 2 +- .../quickstart/rust-wrap-mongo.md | 1 + .../running-keploy/about-api-testing.md | 66 ++++ .../running-keploy/about-unit-testing.md | 36 +++ .../running-keploy/api-test-architecture.md | 51 ++++ .../running-keploy/api-test-generator.md | 43 +-- .../best-practices-api-testing.md | 84 ++++++ .../running-keploy/test-generate.md | 76 +++++ .../running-keploy/test-run-reports.md | 118 ++++++++ .../running-keploy/unit-test-architecture.md | 38 +++ .../running-keploy/unit-test-generator.md | 151 +--------- .../running-keploy/utg-pr-agent.md | 95 ++++++ .../running-keploy/utg-vsc-extension.md | 131 ++++++++ .../version-2.0.0-sidebars.json | 6 +- .../version-3.0.0-sidebars.json | 233 ++++++++------ 32 files changed, 1948 insertions(+), 336 deletions(-) create mode 100644 src/components/Product.js create mode 100644 src/components/UtgMethods.js create mode 100644 versioned_docs/version-3.0.0/keploy-explained/ai-models.md create mode 100644 versioned_docs/version-3.0.0/keploy-explained/api-testing-faq.md rename versioned_docs/version-3.0.0/keploy-explained/{faq.md => integration-testing-faq.md} (95%) create mode 100644 versioned_docs/version-3.0.0/keploy-explained/integrations-pr-agent.md create mode 100644 versioned_docs/version-3.0.0/keploy-explained/integrations-vscode.md create mode 100644 versioned_docs/version-3.0.0/keploy-explained/keploy-privacy.md create mode 100644 versioned_docs/version-3.0.0/keploy-explained/keploy-security.md create mode 100644 versioned_docs/version-3.0.0/keploy-explained/supported-languages.md create mode 100644 versioned_docs/version-3.0.0/keploy-explained/unit-testing-faq.md create mode 100644 versioned_docs/version-3.0.0/keploy-explained/utg-best-practices.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/about-api-testing.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/about-unit-testing.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/api-test-architecture.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/best-practices-api-testing.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/test-generate.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/test-run-reports.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/unit-test-architecture.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/utg-pr-agent.md create mode 100644 versioned_docs/version-3.0.0/running-keploy/utg-vsc-extension.md diff --git a/docusaurus.config.js b/docusaurus.config.js index 81fb5a76d..de0cf1b20 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -116,32 +116,45 @@ module.exports = { }, items: [ { - to: "/server/installation", - activeBasePath: "none", - label: "Installation", + label: "Products", + position: "left", + items: [ + { + label: "Unit Testing", + to: "/running-keploy/utg-pr-agent/", + }, + { + label: "Integration Testing", + to: "/keploy-explained/introduction", + }, + { + label: "API Testing", + to: "/running-keploy/about-api-testing", + }, + ], }, - // { - // to: "/server/installation/", - // label: "Installation", - // }, - // { - // to: "/docs/operation/web-ui-operations/", - // activeBasePath: "(/docs/operation)", - // label: "Operations", - // }, - // { - // to: "/docs/go/quickstart/run-your-first-app-tutorial/", - // activeBaseRegex: - // "(/application-development)|(/docs/(go|java|php|node))", - // label: "test SDKs", - // }, { - to: "/keploy-explained/contribution-guide", - label: "Contribution Guide", + label: "Blog", + items: [ + { + label: "Tech Blogs", + href: "https://keploy.io/blog/technology", + }, + { + label: "Communtity Articles", + href: "https://keploy.io/blog/community", + }, + { + label: "Glossary", + href: "/concepts/reference/glossary/", + }, + ], + position: "left", }, { - to: "https://keploy.io/blog", - label: "Blog", + to: "/keploy-explained/contribution-guide", + label: "Contribution Guide", + position: "left", }, { type: "docsVersionDropdown", @@ -154,12 +167,6 @@ module.exports = { className: "header-github-link", "aria-label": "GitHub repository", }, - // TODO : Add Blogging Section - // { - // to: "/blog", - // activeBasePath: "/blog", - // label: "Blog", - // }, ], }, footer: { diff --git a/src/components/Product.js b/src/components/Product.js new file mode 100644 index 000000000..424749fbe --- /dev/null +++ b/src/components/Product.js @@ -0,0 +1,255 @@ +import React from "react"; +import Link from "@docusaurus/Link"; +import useBaseUrl from "@docusaurus/useBaseUrl"; + +function UTG() { + return ( +
+
    +
  • + +
    +
    + + + +

    + Unit Testing Agent +

    +
    +
      +
    • +

      + Generate reliable, validated tests as you code, ensuring + coverage and stability. +

      +
    • +
    +
    + +
  • +
  • + +
    +
    + + + + + + + +

    + Integration Testing +

    +
    +
      +
    • +

      + Records and replays API calls with mocks for reliable + integration testing and stability. +

      +
    • +
    +
    + +
  • +
  • + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + undefined + +

    + API Testing Agent +

    +
    +
      +
    • +

      + Generates API tests from your docs, covering edge cases, + ensuring coverage. +

      +
    • +
    +
    + +
  • +
+
+ ); +} + +export const Products = () => { + return ( +
+

+ Products 🛠️ +

+

+ Keploy provides three key products that help you streamline your testing + workflow: +

+ +
+ +
+
+ ); +}; diff --git a/src/components/QuickStart.js b/src/components/QuickStart.js index de63666fb..72543cc63 100644 --- a/src/components/QuickStart.js +++ b/src/components/QuickStart.js @@ -5,12 +5,12 @@ import useBaseUrl from "@docusaurus/useBaseUrl"; export const QuickStart = () => { return (
-

+

Welcome to Keploy Documentation! 🚀

- This documentation is your roadmap to becoming a Keploy expert, whether - you're a seasoned developer or just starting out. 🗺️ + This documentation will help you get the most out of Keploy—whether + you’re building your first project or leveling up your testing workflow.

@@ -19,37 +19,40 @@ export const QuickStart = () => {

Keploy is your open-source, developer-centric backend testing tool. It makes backend testing easy and productive for engineering teams. Plus, - it's easy-to-use, powerful and extensible..🛠️ + it's easy-to-use, powerful and extensible..🛠️ Keploy also has AI-powered + tools that help you generate unit and api tests quickly, helping + developers focus on writing code rather than writing tests.

+

Keploy creates test cases and data mocks/stubs from user-traffic by recording API calls and DB queries, significantly speeding up releases and enhancing reliability. 📈

-

- Contribute through Hacktoberfest ✅ -

-

- DigitalOcean's Hacktoberfest is a month-long celebration of open-source - contributions. Everyone is welcome to participate, regardless of their - experience level. Simply make a pull request to an open-source project - to get started. -

- You can contribute to{" "} - - several Keploy projects - {" "} - participating this year, If you’ve ever wanted to contribute to open - source , now is your chance! -

- Anyone around the globe who desires to help drive the growth of open - source and make positive contributions to an ever-growing community. All - backgrounds and skill levels are encouraged to participate.{" "} - - Learn How to Contribute? - -

+ {/*

*/} + {/* Contribute through Hacktoberfest ✅*/} + {/*

*/} + {/*

*/} + {/* DigitalOcean's Hacktoberfest is a month-long celebration of open-source*/} + {/* contributions. Everyone is welcome to participate, regardless of their*/} + {/* experience level. Simply make a pull request to an open-source project*/} + {/* to get started.*/} + {/*

*/} + {/* You can contribute to{" "}*/} + {/* */} + {/* several Keploy projects*/} + {/* {" "}*/} + {/* participating this year, If you’ve ever wanted to contribute to open*/} + {/* source , now is your chance!*/} + {/*

*/} + {/* Anyone around the globe who desires to help drive the growth of open*/} + {/* source and make positive contributions to an ever-growing community. All*/} + {/* backgrounds and skill levels are encouraged to participate.{" "}*/} + {/* */} + {/* Learn How to Contribute?*/} + {/* */} + {/*

*/}

Installation Guide 📗 diff --git a/src/components/UtgMethods.js b/src/components/UtgMethods.js new file mode 100644 index 000000000..c5ac9d543 --- /dev/null +++ b/src/components/UtgMethods.js @@ -0,0 +1,147 @@ +import React from "react"; +import Link from "@docusaurus/Link"; +import useBaseUrl from "@docusaurus/useBaseUrl"; + +function UTGMethods() { + return ( +
+

+ Three Ways to Generate Unit Tests 🚀 +

+

+ Choose the method that best fits your workflow - from automated PR + integration to one-click IDE generation: +

+ +
    +
  • + +
    +
    + + + + + + +

    + PR Agent (Latest) +

    +
    +
      +
    • +

      + Automatically generates unit tests when you create pull + requests. Install once, get tests for every PR with changed + files. +

      +
    • +
    +
    + +
  • + +
  • + +
    +
    + + + + + +

    + VS Code Extension +

    +
    +
      +
    • +

      + One-click unit test generation directly in VS Code. Install + the extension and generate tests for your entire project + instantly. +

      +
    • +
    +
    + +
  • + +
  • + +
    +
    + + + + +

    + Command Line Interface +

    +
    +
      +
    • +

      + Traditional CLI approach with full control over test + generation. Perfect for CI/CD pipelines and automated + workflows. +

      +
    • +
    +
    + +
  • +
+
+ ); +} + +export default UTGMethods; diff --git a/src/css/custom.css b/src/css/custom.css index 6ec819b4d..12b4187ae 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -223,11 +223,11 @@ div[class^="sidebar_"] .button svg { /* Navbar */ .navbar__inner { - @apply mx-auto max-w-screen-lg shadow-none lg:px-10; + @apply mx-auto w-full max-w-none px-4 shadow-none lg:px-10; } .navbar__items--right { - @apply flex-row-reverse; + @apply justify-end ml-auto flex-row-reverse; } .navbar__items--right > :last-child { diff --git a/src/pages/index.js b/src/pages/index.js index ba654a28a..711fdaea4 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -2,7 +2,7 @@ import React from "react"; import Layout from "@theme/Layout"; import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; import {Community, KeployCloud, Resources, QuickStart} from "../components"; -import {GSoC} from "../components/GSoC"; +import {Products} from "../components/Product"; import {Intro} from "../components"; export default function Home() { const context = useDocusaurusContext(); @@ -19,6 +19,7 @@ export default function Home() { {/* */} {/**/} + {/**/} diff --git a/versioned_docs/version-3.0.0/keploy-explained/ai-models.md b/versioned_docs/version-3.0.0/keploy-explained/ai-models.md new file mode 100644 index 000000000..58513df5c --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/ai-models.md @@ -0,0 +1,40 @@ +--- +id: ai-models +title: How Keploy Uses AI Models for Testing +sidebar_label: How Keploy Uses AI Models for Testing +description: How Keploy leverages state-of-the-art AI models for next-generation testing automation. +tags: + - AI + - LLM + - unit testing + - Gemini + - GPT-4 +--- + +# 🤖 AI Models at Keploy + +Keploy is a vertical testing agent, built to generate high-quality unit tests using the world’s best AI. + +We don’t just rely on one model—we harness the strengths of multiple cutting-edge LLMs to give you smarter, more accurate, and more relevant tests. + +## 🚀 Multi-Model, Multi-Benefit + +- **Gemini 2.5 Pro (Google):** Advanced reasoning, code understanding, and context awareness. +- **GPT-4 Family (OpenAI):** Exceptional language ability, coverage of edge cases, and broad code knowledge. +- **Other Specialized Models:** We continuously evaluate and integrate new AI models to keep raising the bar for testing automation. + +By combining different models, Keploy can generate better test cases, filter out weak tests, and cover more scenarios. + +## 🏗️ How It Works + +- **Best of All Worlds:** For each test file, Keploy routes tasks to different models—letting each one play to its strengths. +- **Quality Over Quantity:** Results are validated and cross-checked, so you get fewer, but stronger and more useful tests. +- **Rapid Updates:** As AI models evolve, Keploy upgrades seamlessly—always keeping you on the leading edge. + +## 🌐 Transparency & User Trust + +- **No Code Used for Training:** Your code and test data are **never** used to train any external AI model. + +- **Model Selection:** We choose models for you automatically, but always with a focus on security, reliability, and test quality. + +Want to learn more about how AI powers Keploy? [Contact us](mailto:support@keploy.io) diff --git a/versioned_docs/version-3.0.0/keploy-explained/api-testing-faq.md b/versioned_docs/version-3.0.0/keploy-explained/api-testing-faq.md new file mode 100644 index 000000000..9d56dcd20 --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/api-testing-faq.md @@ -0,0 +1,59 @@ +--- +id: api-testing-faq +title: API Testing – Frequently Asked Questions +sidebar_label: FAQs +description: Answers to the most common questions about API testing with Keploy. +tags: + - explanation + - faq +--- + +# Got Questions? We’ve Got Answers! 🚀 + +Everything you want to know about API testing with Keploy—straightforward and no fluff. + +### 1. What types of API tests can Keploy generate? + +Keploy automatically creates: + +- **Functional Tests:** CRUD operations, endpoint validation +- **Edge Case Tests:** Invalid payloads, error responses +- **Performance Tests:** Response time checks +- **Security Tests:** Input sanitization, auth validation +- **Dependency Tests:** Mocked external service calls + +### 2. How does Keploy handle authentication in API tests? + +Keploy supports: + +- **Auth Types:** JWT, OAuth2, API Keys, Basic Auth +- **Auto-Renewal:** Token refresh flows +- **Test Isolation:** Separate auth contexts per test +- **Security:** No raw credentials stored—uses environment variables + +### 3. What protocols and formats does Keploy support? + +| Protocol | Formats | Features | +| ---------- | ---------------- | ----------------- | +| HTTP/HTTPS | JSON, XML | Full support | +| gRPC | Protocol Buffers | Code generation | +| WebSockets | JSON, Binary | Session testing | +| GraphQL | Query/Mutation | Schema validation | + +### 4. How does test generation work for stateful APIs? + +Keploy handles stateful workflows by: + +1. Recording session cookies/headers +2. Detecting data dependencies between calls +3. Generating cleanup steps (teardown) +4. Creating isolated test contexts + +**Example:** +`POST /cart → GET /cart → POST /checkout → GET /order/{id}` + +Hope this helps you out, if you still have any questions, reach out to us . + +import GetSupport from '../concepts/support.md' + + diff --git a/versioned_docs/version-3.0.0/keploy-explained/how-keploy-works.md b/versioned_docs/version-3.0.0/keploy-explained/how-keploy-works.md index 9186595cb..fb49dc1fd 100644 --- a/versioned_docs/version-3.0.0/keploy-explained/how-keploy-works.md +++ b/versioned_docs/version-3.0.0/keploy-explained/how-keploy-works.md @@ -1,7 +1,7 @@ --- id: how-keploy-works title: How Keploy Works? -sidebar_label: How Keploy Works? +sidebar_label: Architecture tags: - explanation - replay-test-case diff --git a/versioned_docs/version-3.0.0/keploy-explained/faq.md b/versioned_docs/version-3.0.0/keploy-explained/integration-testing-faq.md similarity index 95% rename from versioned_docs/version-3.0.0/keploy-explained/faq.md rename to versioned_docs/version-3.0.0/keploy-explained/integration-testing-faq.md index d37749ce4..ad36d68be 100644 --- a/versioned_docs/version-3.0.0/keploy-explained/faq.md +++ b/versioned_docs/version-3.0.0/keploy-explained/integration-testing-faq.md @@ -1,12 +1,14 @@ --- -id: faq -title: Frequently Asked Questions (FAQ) -sidebar_label: FAQ +id: integration-testing-faq +title: Frequently Asked Questions +sidebar_label: FAQs tags: - explanation - faq --- +# Got Questions? We’ve Got Answers! 🚀 + Let's get to the heart of Keploy with some fun Q&A! ### 1. What is Keploy? diff --git a/versioned_docs/version-3.0.0/keploy-explained/integrations-pr-agent.md b/versioned_docs/version-3.0.0/keploy-explained/integrations-pr-agent.md new file mode 100644 index 000000000..53f4bac2c --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/integrations-pr-agent.md @@ -0,0 +1,29 @@ +--- +id: integrations-pr-agent +title: Integrations & Connected Tools +sidebar_label: Integrations & Connected Tools +description: See which platforms Keploy integrates with for automated PR testing. +tags: + - integrations + - github + - PR agent +--- + +# 🔗 Integrations with SCM + +Keploy’s PR Agent helps automate code reviews, testing, and feedback—right where you work. + +## ✅ Currently Supported + +**GitHub:** + Our PR Agent seamlessly integrates with GitHub repositories for test automation, coverage checks, and intelligent feedback on your pull requests. + +## 💡 Need Support for Another Platform? + +Want Keploy’s PR Agent on GitLab, Bitbucket, or another platform? + +[Reach out to our team!](mailto:support@keploy.io) + +We’re always open to feedback and requests as we expand our integration support. + +**More integrations are coming soon—stay tuned!** diff --git a/versioned_docs/version-3.0.0/keploy-explained/integrations-vscode.md b/versioned_docs/version-3.0.0/keploy-explained/integrations-vscode.md new file mode 100644 index 000000000..2c83195ac --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/integrations-vscode.md @@ -0,0 +1,29 @@ +--- +id: integrations-vscode +title: Integrations & Connected Tools +sidebar_label: Integrations & Connected Tools +description: Learn about IDE integrations for Keploy’s AI-powered unit testing. +tags: + - integrations + - vscode + - unit testing +--- + +# 🔌 Integrations with IDEs + +Keploy aims to make AI-powered unit testing as seamless as possible—right inside your favorite tools. + +## ✅ Currently Supported + +**Visual Studio Code (VS Code):** + We offer smooth integration with VS Code, so you can generate, view, and manage AI-generated unit tests without leaving your IDE. + +## 💡 Want Support for Another IDE? + +Need Keploy in JetBrains, Neovim, or another editor? + +[Reach out to our team!](mailto:support@keploy.io) + +Your feedback shapes our roadmap! + +More IDE integrations are coming soon—stay tuned. diff --git a/versioned_docs/version-3.0.0/keploy-explained/keploy-privacy.md b/versioned_docs/version-3.0.0/keploy-explained/keploy-privacy.md new file mode 100644 index 000000000..119ef9554 --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/keploy-privacy.md @@ -0,0 +1,33 @@ +--- +id: keploy-privacy +title: Code Privacy & Data Protection +sidebar_label: Code Privacy & Data Protection +description: Keploy’s privacy commitments—your code, data, and trust are safe with us. +tags: + - privacy + - code privacy + - security +--- + +# 🛡️ Privacy at Keploy + +Your code is yours—always. +Keploy is built with privacy as a core value. Here’s how we keep your code and data safe: + +## 🚫 Code Privacy: Your Code is Never Used for Training + +- **No Model Training:** We do **not** use your code, test cases, or data to train our AI models. +- **No Sharing:** Keploy never shares your code, test data, or usage information with any third parties. +- **No Data Mining:** We do **not** mine, analyze, or extract information from your code for any commercial or marketing purposes. + +## 🕵️‍♂️ General Privacy Commitments + +- **End-to-End Confidentiality:** All code, data, and metadata processed by Keploy are encrypted and kept confidential. +- **User Control:** You have full control over your data and can delete it at any time. +- **Transparency:** We’re always open about our data handling practices—no hidden surprises. + +## 🔒 Your Trust, Our Priority + +We’re committed to making privacy non-negotiable. + +Have questions, concerns, or requests? [Contact our team](mailto:support@keploy.io)—we’re here to help. diff --git a/versioned_docs/version-3.0.0/keploy-explained/keploy-security.md b/versioned_docs/version-3.0.0/keploy-explained/keploy-security.md new file mode 100644 index 000000000..88f233c2c --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/keploy-security.md @@ -0,0 +1,40 @@ +--- +id: keploy-security +title: Security & Compliance at Keploy +sidebar_label: Security & Compliance at Keploy +description: Learn about Keploy's secure, compliant, and resilient approach to platform security. +tags: + - security + - compliance + - reliability +--- + +# 🔒 Security at Keploy + +At Keploy, your trust and data protection are our top priorities. +We provide a secure, reliable, and resilient platform—designed from the ground up with security in mind, following industry best practices every step of the way. + +## ✅ Built on Industry Best Practices + +- **End-to-End Security:** All data is protected in transit and at rest using strong encryption standards. +- **Regular Audits:** Our platform undergoes continuous security reviews and assessments. +- **Resilient Infrastructure:** Redundant, scalable systems ensure your tests and data are always safe and available. +- **Least Privilege:** We follow the principle of least privilege, so your data and systems are never exposed unnecessarily. + +## 🛡️ Compliant with Leading Standards + +Keploy is committed to meeting the most stringent security and privacy standards: + +- 🔒 **ISO 27001** +- 🔒 **GDPR** +- 🔒 **SOC 2** +- 🔒 **HIPAA** + +Your data remains confidential and secure—whether you’re a startup or an enterprise. + +## 🤝 Responsible & Transparent + +- **No Sharing of Your Data:** Your test data stays private and is never used for anything other than your own testing and analysis. +- **Full Transparency:** We are open about our processes and happy to answer any questions you have about security or privacy. + +Have questions or need a security report for your team? [Contact us!](mailto:support@keploy.io) diff --git a/versioned_docs/version-3.0.0/keploy-explained/supported-languages.md b/versioned_docs/version-3.0.0/keploy-explained/supported-languages.md new file mode 100644 index 000000000..e60bfb07f --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/supported-languages.md @@ -0,0 +1,50 @@ +--- +id: supported-languages +title: Supported Languages for Unit Testing +sidebar_label: Supported Languages for Unit Testing +description: Which languages Keploy supports for AI-powered unit test generation. +tags: + - unit testing + - supported languages + - go + - java +--- + +# 🌍 Supported Languages for Unit Testing + +Keploy is a vertical AI testing agent—built to deliver real, valuable tests (not just code snippets!) for your codebase. + +Here’s where we are today, and what makes us different: + +## ✅ Currently Supported + +**Go (Golang):** Our most mature integration. + +Keploy generates _and runs_ AI-powered unit tests for your Go projects. + +**Only the tests that actually increase code coverage and pass reliably are kept anything else is filtered out.** + +## 🚀 Coming Soon + +**Java:** + Java support is on the way! + +We’ll bring the same AI-driven, high-quality test generation and validation workflow to Java soon. + +## 🧩 Why Only a Few Languages (for now)? + +**We don’t just create test code—we validate every AI-generated test:** + +- Each test is executed against your actual codebase. +- If a test builds, runs, and increases coverage, it’s included. +- If it doesn’t add value, it’s automatically discarded. + +This rigorous, quality-first approach means we focus on fewer languages, but deliver _real_, _useful_ tests—not noisy, irrelevant code. + +## 💬 Want More Languages? + +We’re expanding—tell us what language you need next! +[Let us know!](mailto:support@keploy.io) + +**Our Promise:** +No matter the language, Keploy helps you create _meaningful_, _maintainable_ tests that genuinely improve your code—not just sample outputs. diff --git a/versioned_docs/version-3.0.0/keploy-explained/unit-testing-faq.md b/versioned_docs/version-3.0.0/keploy-explained/unit-testing-faq.md new file mode 100644 index 000000000..a542e594a --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/unit-testing-faq.md @@ -0,0 +1,51 @@ +--- +id: unit-testing-faq +title: Frequently Asked Questions +sidebar_label: FAQs +tags: + - explanation + - faq +--- + +# Got Questions? We’ve Got Answers! 🚀 + +Everything you want to know about Unit testing with Keploy—straightforward and no fluff. + +### 1. What is Keploy's Unit Test Generator (UTG)? + +Keploy's UTG automates the creation of unit tests based on code semantics, enhancing test coverage and reliability. + +### 2. Does Keploy send your private data to any cloud server for test generation? + +No, Keploy does not send any user code to remote systems, except when using the unit test generation feature. When using the UT gen feature, only the source code and the unit test code will be sent to the Large Language Model (LLM) you are using. By default, Keploy uses - litellm to support vast number of LLM backends. Yes, if your organization has its own LLM(a private one), you can use it with Keploy. This ensures that data is not sent to any external systems. + +### 3. How does Keploy contribute to improving unit test coverage? + +By providing a zero code platform for automated testing, Keploy empowers developers to scale up their unit test coverage without extensive coding knowledge. This integration enhances testing reports, ultimately boosting confidence in the product's quality. + +### 4. Is Keploy cost-effective for automated unit testing? + +Yes, Keploy optimizes costs by automating repetitive testing tasks and improving overall test efficiency. + +### 5. How does Keploy generate coverage reports? + +Keploy generates detailed Cobertura format reports, offering insights into test effectiveness and code quality. + +### 6. Can Keploy handle large codebases efficiently? + +Yes, Keploy is designed to handle large codebases efficiently, though processing time may vary based on project size and complexity. + +### 7. Which method should I choose for generating unit tests? + +- **PR Agent**: Best for teams using pull request workflows who want automatic test generation +- **VS Code Extension**: Ideal for individual developers who prefer IDE integration + +### 8. Do I need an API key to use these two methods? + +The API key is primarily required for the Command Line method. The PR Agent and VS Code Extension may have different authentication mechanisms depending on your setup. + +Hope this helps you out, if you still have any questions, reach out to us . + +import GetSupport from '../concepts/support.md' + + diff --git a/versioned_docs/version-3.0.0/keploy-explained/utg-best-practices.md b/versioned_docs/version-3.0.0/keploy-explained/utg-best-practices.md new file mode 100644 index 000000000..316e9a80a --- /dev/null +++ b/versioned_docs/version-3.0.0/keploy-explained/utg-best-practices.md @@ -0,0 +1,283 @@ +--- +id: utg-best-practices +title: Best practices for unit testing and UTG? +sidebar_label: Best Practices? +tags: + - explanation + - why keploy + - automated testing + - test scripts + - manual testing + - record replay test +--- + +> **Master the art of automated testing with proven strategies, expert insights, and advanced techniques for maximizing your testing ROI.** + +This comprehensive guide outlines battle-tested best practices for writing exceptional unit tests, leveraging automation effectively, and extracting maximum value from Keploy's Unit Test Generation ecosystem — including the PR Agent and VS Code extension. + +## **Foundational Unit Testing Principles** + +### **1. Single Responsibility Testing** + +Each unit test should validate exactly one behavior or functionality. This laser-focused approach improves debugging efficiency and makes test failures immediately actionable. + +```javascript +// Good: Tests one specific behavior +test("should calculate discount for premium customers", () => { + // Test implementation +}); + +// Avoid: Testing multiple concerns +test("should calculate discount and send email and update database", () => { + // Too many responsibilities +}); +``` + +### **2. Test Isolation & Independence** + +Design tests to run in any order without side effects. Each test should create its own test data and clean up after itself. + +**Key Strategies:** + +- Use setup/teardown methods effectively +- Avoid shared mutable state between tests +- Implement proper database/file system cleanup +- Use fresh object instances for each test + +### **3. Descriptive Test Naming Convention** + +Adopt a consistent naming pattern that immediately communicates intent, context, and expected outcome. + +**Recommended Pattern:** + +``` +should[ExpectedBehavior]When[SpecificCondition] +``` + +**Examples:** + +- `shouldReturnErrorWhenInputIsNull()` +- `shouldCalculateCorrectTaxForHighIncomeUsers()` +- `shouldThrowTimeoutExceptionWhenApiResponseDelayed()` + +### **4. AAA Pattern Implementation** + +Structure every test using the Arrange-Act-Assert pattern for maximum clarity and maintainability: + +```javascript +test("shouldCalculateCorrectInterest", () => { + // Arrange: Set up test data and conditions + const principal = 1000; + const rate = 5; + const time = 2; + + // Act: Execute the function under test + const result = calculateSimpleInterest(principal, rate, time); + + // Assert: Verify the expected outcome + expect(result).toBe(100); +}); +``` + +### **5. Test-Driven Development Integration** + +Consider implementing TDD workflows where tests drive design decisions: + +- **Red Phase**: Write failing tests first +- **Green Phase**: Implement minimal code to pass tests +- **Refactor Phase**: Improve code while keeping tests green +- **Benefits**: Better API design, improved code coverage, reduced debugging time + +### **6. Strategic Dependency Mocking** + +Isolate units under test by mocking external dependencies: + +**When to Mock:** + +- External APIs and web services +- Database connections and queries +- File system operations +- Time-dependent functions +- Third-party libraries with side effects + +**When NOT to Mock:** + +- Simple value objects and DTOs +- Internal utility functions +- Domain logic that should be tested together + +## **Advanced Automated Testing Strategies** + +### **1. Treat Generated Tests as Intelligence Amplifiers** + +Leverage Keploy UTG-generated tests as sophisticated starting points rather than final solutions: + +- **Review Generated Logic**: Validate that test assertions match business requirements +- **Enhance Edge Cases**: Add domain-specific edge cases that AI might miss +- **Refine Assertions**: Strengthen test assertions with business-specific validations +- **Add Context**: Include comments explaining complex business logic + +### **2. Intelligent Test Organization** + +Implement a hierarchical structure that scales with your codebase: + +``` +tests/ +├── unit/ +│ ├── components/ +│ ├── services/ +│ └── utils/ +├── integration/ +├── e2e/ +└── fixtures/ + ├── data/ + └── mocks/ +``` + +### **3. Coverage-Driven Quality Metrics** + +Focus on meaningful coverage metrics rather than arbitrary percentage targets: + +- **Critical Path Coverage**: Ensure 100% coverage for business-critical functions +- **Branch Coverage**: Validate all conditional logic paths +- **Error Path Coverage**: Test exception handling and error scenarios +- **Integration Point Coverage**: Focus on boundaries between modules + +### **4. CI/CD Pipeline Integration** + +Embed automated testing into every stage of your development pipeline: + +- **Pre-commit Hooks**: Run unit tests before code commits +- **PR Validation**: Automatically trigger test generation and execution +- **Deployment Gates**: Block deployments without adequate test coverage +- **Performance Monitoring**: Track test execution time and optimize slow tests + +### **5. Version Control Best Practices** + +Maintain test code with the same rigor as production code: + +- **Meaningful Commit Messages**: Document test changes clearly +- **Test Code Reviews**: Review generated and modified tests thoroughly +- **Test Refactoring**: Keep tests clean and maintainable +- **Documentation Updates**: Update test documentation with code changes + +## **Keploy UTG PR Agent Mastery** + +### **1. Pre-PR Test Generation Workflow** + +Integrate PR Agent into your development workflow for maximum efficiency: + +```bash +# Recommended workflow +git checkout -b feature/new-payment-method +# Implement your changes +git add . +git commit -m "feat: add cryptocurrency payment support" +# PR Agent automatically analyzes changes and suggests tests +git push origin feature/new-payment-method +``` + +### **2. Intelligent Test Review Process** + +Develop a systematic approach to reviewing AI-generated tests: + +**Review Checklist:** + +- Do test assertions match business requirements? +- Are edge cases relevant to the domain? +- Do mocks accurately represent external dependencies? +- Are test names descriptive and meaningful? +- Is test data realistic and varied? + +### **3. Strategic Commit Message Patterns** + +Use consistent commit messages when integrating PR Agent results: + +```bash +# Descriptive patterns +git commit -m "test: add unit tests for payment processing module" +git commit -m "test: enhance edge case coverage for user authentication" +git commit -m "test: update mocks for external API integration" +``` + +### **4. Hybrid Testing Approach** + +Combine automated generation with manual expertise: + +- **Auto-Generated Foundation**: Use PR Agent for baseline test coverage +- **Manual Enhancement**: Add business-specific test scenarios +- **Domain Expert Review**: Have domain experts validate test logic +- **Continuous Refinement**: Iteratively improve generated test quality + +## **VS Code Extension Power User Techniques** + +### **1. Real-Time Development Integration** ⚡ + +Maximize productivity by generating tests during active development: + +- **Function-Level Testing**: Generate tests immediately after writing functions +- **Refactoring Safety**: Create tests before refactoring existing code +- **Bug Reproduction**: Generate tests to reproduce and fix reported bugs +- **API Exploration**: Use generated tests to understand third-party APIs + +### **2. Advanced Configuration Management** + +Customize the VS Code extension for optimal team workflows: + +```json +{ + "keploy.utg.outputDirectory": "./tests", + "keploy.utg.testFramework": "jest", + "keploy.utg.mockingStrategy": "auto", + "keploy.utg.coverageTarget": "branches", + "keploy.utg.namingConvention": "descriptive" +} +``` + +### **3. Incremental Test Development** + +Build comprehensive test suites incrementally: + +- **Start Small**: Begin with core utility functions +- **Expand Gradually**: Add tests for more complex business logic +- **Maintain Quality**: Regularly review and refactor generated tests +- **Document Patterns**: Create team guidelines for test generation + +### **4. Integration with Development Workflow** + +Seamlessly blend test generation with existing development practices: + +- **Code Review Integration**: Generate tests before requesting code reviews +- **Pair Programming**: Use generated tests as conversation starters +- **Knowledge Sharing**: Use tests to document expected behavior +- **Onboarding Tool**: Help new team members understand codebase behavior + +## **Advanced Metrics & Monitoring** + +### **Test Quality Indicators** + +- **Assertion Strength**: Measure specificity and relevance of test assertions +- **Mock Accuracy**: Evaluate how well mocks represent real dependencies +- **Edge Case Coverage**: Track coverage of boundary conditions and error scenarios +- **Maintenance Overhead**: Monitor time spent maintaining generated tests + +### **Team Adoption Metrics** + +- **Generation Frequency**: Track how often team members use UTG tools +- **Review Efficiency**: Measure time saved in code review processes +- **Bug Detection Rate**: Monitor bugs caught by generated tests +- **Developer Satisfaction**: Survey team satisfaction with automated testing tools + +## **Pro Tips for Success** + +- **Start with High-Impact Areas**: Focus on business-critical code first +- **Invest in Team Training**: Ensure everyone understands best practices +- **Monitor and Adjust**: Regularly evaluate and improve your testing approach +- **Community Engagement**: Share experiences and learn from other teams +- **Continuous Learning**: Stay updated with testing industry best practices + +_Remember: Automated testing tools are force multipliers, not replacements for thoughtful testing strategy. The goal is to amplify human expertise, not replace human judgment._ + +import GetSupport from '../concepts/support.md' + + diff --git a/versioned_docs/version-3.0.0/quickstart/nextjs-postgres.md b/versioned_docs/version-3.0.0/quickstart/nextjs-postgres.md index b6f199b27..caea5df71 100644 --- a/versioned_docs/version-3.0.0/quickstart/nextjs-postgres.md +++ b/versioned_docs/version-3.0.0/quickstart/nextjs-postgres.md @@ -96,7 +96,7 @@ Time to put things to the test 🧪 sudo -E env PATH=$PATH keploy test -c "npm run dev" --delay 10 ``` -![Test Record](../../../static/img/nextjs-postgres-test.png) +![Test Run](../../../static/img/nextjs-postgres-test.png) > The `--delay` flag? Oh, that's just giving your app a little breather (in seconds) before the test cases come knocking. diff --git a/versioned_docs/version-3.0.0/quickstart/rust-wrap-mongo.md b/versioned_docs/version-3.0.0/quickstart/rust-wrap-mongo.md index 5006cfb75..e2e051465 100644 --- a/versioned_docs/version-3.0.0/quickstart/rust-wrap-mongo.md +++ b/versioned_docs/version-3.0.0/quickstart/rust-wrap-mongo.md @@ -87,6 +87,7 @@ curl --location 'http://localhost:8000/api/notes/6618fa20875aedcfe96e08ed' ``` This is how keploy terminal would look like: + ![Testcase](../../../static/img/rust-crud-record.png?raw=true) ### Run the testcases diff --git a/versioned_docs/version-3.0.0/running-keploy/about-api-testing.md b/versioned_docs/version-3.0.0/running-keploy/about-api-testing.md new file mode 100644 index 000000000..02f9f7171 --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/about-api-testing.md @@ -0,0 +1,66 @@ +--- +id: about-api-testing +title: What is API testing? +sidebar_label: What is API testing? +description: This section documents what is API Testing and why we need it +tags: + - API testing + - API mocks + - generate test cases + - test automation +keywords: + - api testing + - api mocks + - automated testing + - ai testing + - keploy + - Gemini + - OpenAI +--- + +# 📘 What is API Testing? + +**API Testing** is a type of software testing that focuses on verifying that **Application Programming Interfaces (APIs)** function as expected. Instead of testing the UI, API tests validate business logic, data responses, and the performance of an application’s backend services. + +APIs act as the _bridge_ between different software systems — enabling communication and data exchange. Testing ensures these bridges are **reliable, secure, and performant**. + +## ✅ Why Do We Need API Testing? + +| Reason | Description | +| --------------------------------- | --------------------------------------------------------------------------------------------------------- | +| **1. Early Bug Detection** | API testing is usually done before UI testing, allowing faster detection and resolution of critical bugs. | +| **2. Improved Test Coverage** | Validates all layers of the application including edge cases, error codes, and data responses. | +| **3. Faster Execution** | API tests are faster than UI tests, enabling quicker feedback loops in CI/CD pipelines. | +| **4. Language-Agnostic** | APIs can be tested independently of the frontend technology — enabling broader automation. | +| **5. Enhanced Security** | Validates authentication, authorization, and data privacy mechanisms. | +| **6. Enables Continuous Testing** | Ideal for automated pipelines to ensure every build meets quality standards. | + +## 🧪 What Do We Test in an API? + +- Request & Response Validation +- Status Codes (200, 400, 500, etc.) +- Data Format (JSON, XML, etc.) +- Authentication & Authorization +- Load and Performance +- Edge Cases and Error Handling + +## 🔍 Types of API Testing + +| Type | Description | +| ----------------------------------- | ------------------------------------------------------------------------ | +| **Functional Testing** | Ensures the API performs expected functions correctly with valid inputs. | +| **Validation Testing** | Verifies the API meets business and technical requirements. | +| **Load Testing** | Evaluates how the API handles a large volume of requests. | +| **Security Testing** | Checks for vulnerabilities, data leaks, and access control. | +| **Error/Negative Testing** | Validates behavior when given invalid inputs or unexpected conditions. | +| **Regression Testing** | Ensures recent changes haven't broken existing functionality. | +| **Runtime and Reliability Testing** | Confirms the API's stability and availability during sustained use. | + +## ⚠️ Common Challenges in API Testing + +- Lack of proper API documentation +- Handling dynamic responses and tokens +- Managing large test data and scenarios +- Testing across multiple environments (dev, staging, prod) +- Ensuring version compatibility and backward support +- Automating complex workflows involving chained API calls diff --git a/versioned_docs/version-3.0.0/running-keploy/about-unit-testing.md b/versioned_docs/version-3.0.0/running-keploy/about-unit-testing.md new file mode 100644 index 000000000..276b7cd72 --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/about-unit-testing.md @@ -0,0 +1,36 @@ +--- +id: about-unit-testing +title: What is Unit Testing? +sidebar_label: What is Unit Testing? +description: Understand the basics of unit testing—why it matters, what we test, and common challenges. +tags: + - unit testing + - basics + - testing +--- + +# 🧩 What is Unit Testing? + +Unit testing is a software testing method where you test individual pieces of your code (usually functions or methods) to make sure they work as expected—all on their own. +Think of it as checking each LEGO brick before building the whole castle. + +## ✅ Why Do We Need Unit Testing? + +- **Catch Bugs Early:** Find problems before they snowball into bigger issues. +- **Safe Refactoring:** Confidently change code, knowing tests have your back. +- **Documentation:** Good unit tests show how functions are _supposed_ to behave. +- **Speeds Up Development:** Less time debugging, more time building features. + +## 🧪 What Do We Test in Unit Testing? + +- **Functions & Methods:** Core logic, business rules, calculations, etc. +- **Edge Cases:** Unusual inputs, invalid data, or unexpected conditions. +- **Return Values:** Are we getting the results we expect? +- **Error Handling:** Does the code handle failures gracefully? + +## ⚠️ Common Challenges in Unit Testing + +- **Mocking Dependencies:** Sometimes hard to isolate code if it calls databases, APIs, etc. +- **Flaky Tests:** Unstable tests that sometimes pass, sometimes fail (super annoying). +- **Coverage Gaps:** Missing tests for edge cases or tricky logic. +- **Maintenance:** Keeping tests up to date as code evolves. diff --git a/versioned_docs/version-3.0.0/running-keploy/api-test-architecture.md b/versioned_docs/version-3.0.0/running-keploy/api-test-architecture.md new file mode 100644 index 000000000..5de011024 --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/api-test-architecture.md @@ -0,0 +1,51 @@ +--- +id: api-test-architecture +title: Behind the Scenes +sidebar_label: Behind the Scenes +description: How Keploy turns your schema and API requests into edge-case API tests—instantly. +tags: + - api testing + - architecture + - OpenAPI + - curl +--- + +# 🛠️ API Testing Architecture + +With Keploy, go from API specs to real, production-grade API tests—**instantly!** +Here’s how our architecture works under the hood. + +![Keploy API Testing Architecture](https://res.cloudinary.com/dfhtr1rwo/image/upload/v1748784682/keploy-api-arch_i3hjco.png) + +> _From schema and cURL to edge-case API tests, pass/fail tracking, and detailed diffs—all automated._ + +## 📋 Requirements to Get Started + +You can use Keploy’s API testing for **any application, in any language**. +To generate the most valuable and accurate test cases, you’ll need: + +### 1. Upload Your OpenAPI Schema (Swagger) + +_Why?_ +This gives Keploy a detailed map of your API endpoints, making test generation much smarter and more precise. + +### 2. Drop in Your cURL Commands + +_Why?_ +Your real-world cURL requests show Keploy how your APIs are actually used, covering positive, negative, and edge cases. + +### 3. Make Your App Publicly Accessible (Ngrok Works Great!) + +_Why?_ +Keploy needs to interact with your live API endpoints to generate and validate tests. Tools like Ngrok make this easy, even for local apps. + +## ⚡ How Keploy Turns Your Inputs Into API Tests + +- Upload your OpenAPI schema, API docs, and cURL requests. +- Keploy analyzes these to auto-generate edge case test cases—covering positive, negative, and neutral scenarios. +- Tests are run, tracked, and diffs are shown so you can catch issues instantly. +- Results are visible at a glance: what passed, what failed, and what needs fixing. + +Ready to try it? [app.keploy.io](https://app.keploy.io) + +Questions? [Contact our team](mailto:support@keploy.io). diff --git a/versioned_docs/version-3.0.0/running-keploy/api-test-generator.md b/versioned_docs/version-3.0.0/running-keploy/api-test-generator.md index c05785e0a..46f17e486 100644 --- a/versioned_docs/version-3.0.0/running-keploy/api-test-generator.md +++ b/versioned_docs/version-3.0.0/running-keploy/api-test-generator.md @@ -1,6 +1,6 @@ --- id: api-test-generator -title: Keploy API Test Generator +title: API Test Generator sidebar_label: API Test Generator description: This section documents usecase of Keploy's API Test Generator tags: @@ -623,44 +623,3 @@ From the dashboard, you can: - Ensure your Live URL is active and responsive - Use OpenAPI schemas for better request/response modeling - Include real production-like inputs wherever possible - -## Frequently Asked Questions(FAQs) - -**1. What types of API tests can Keploy generate?** -Keploy automatically creates: - -- **Functional Tests**: CRUD operations, endpoint validation -- **Edge Case Tests**: Invalid payloads, error responses -- **Performance Tests**: Response time benchmarks -- **Security Tests**: Input sanitization, auth validation -- **Dependency Tests**: Mocked external service calls - -**2. How does Keploy handle authentication in API tests?** -Keploy supports: - -- **Auth Types**: JWT, OAuth2, API Keys, Basic Auth -- **Auto-Renewal**: Token refresh flows -- **Test Isolation**: Separate auth contexts per test -- **Security**: Never stores raw credentials (uses env variables) - -**3. What protocols and formats does Keploy support?** -| Protocol | Formats | Features | -|----------|---------|----------| -| HTTP/HTTPS | JSON, XML | Full support | -| gRPC | Protocol Buffers | Code generation | -| WebSockets | JSON, Binary | Session testing | -| GraphQL | Query/Mutation | Schema validation | - -**4. How does test generation work for stateful APIs?** -Keploy handles stateful workflows by: - -1. Recording session cookies/headers -2. Detecting data dependencies between calls -3. Generating cleanup teardown sequences -4. Creating isolated test contexts - -**Example Order Flow:** - -```text -POST /cart → GET /cart → POST /checkout → GET /order/{id} -``` diff --git a/versioned_docs/version-3.0.0/running-keploy/best-practices-api-testing.md b/versioned_docs/version-3.0.0/running-keploy/best-practices-api-testing.md new file mode 100644 index 000000000..020bad6a9 --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/best-practices-api-testing.md @@ -0,0 +1,84 @@ +--- +id: best-practices-api-testing +title: Best Practices for API testing +sidebar_label: Best Practices +description: This section documents what best practices can be followed while performing API testing +tags: + - API testing + - API mocks + - generate test cases + - test automation + - Best Practices +keywords: + - api testing + - api mocks + - automated testing + - ai testing + - keploy + - Gemini + - OpenAI +--- + +## 🛠️ Best Practices in API Testing + +API testing ensures the reliability, security, and performance of your application's backend services. To build robust, scalable test suites, here are the best practices you should follow: + +### ✅ 1. Define Clear Test Objectives + +- Understand what you're testing — functionality, security, performance, or error handling. +- Align tests with business logic and expected user workflows. + +### 🧪 2. Cover Both Positive and Negative Scenarios + +- Validate how the API responds to correct input. +- Intentionally send malformed, missing, or unauthorized requests to verify error handling and status codes. + +### 🔄 3. Automate Repetitive Tests + +- Integrate API tests into your CI/CD pipeline. +- Automate regression tests for each deployment or commit. + +## 🗃️ 4. Use Data-Driven Testing + +- Store request and response data externally (e.g., JSON files or CSV). +- This keeps test logic clean and improves reusability. + +## 🔐 5. Test Authentication and Authorization + +- Validate token generation, expiration, and refresh flows. +- Confirm users cannot access resources outside their scope. + +### 🕒 6. Measure Performance and Response Times + +- Ensure APIs meet SLAs under normal and load conditions. +- Monitor response time, throughput, and error rates. + +## 🧩 7. Validate Response Structure and Schema + +- Check if all fields exist and are in the correct format (JSON schema validation). +- Flag any unexpected keys or missing data. + +### 🌍 8. Handle Environment Configurations + +- Avoid hardcoding endpoints and credentials. +- Use environment variables or configuration files for flexibility across dev, staging, and prod. + +### 📦 9. Use Mocks and Stubs When Needed + +- Isolate APIs under test from third-party dependencies. +- Simulate edge cases or failure scenarios not easily reproducible in production. + +### 📈 10. Track and Version API Tests + +- Keep your API test suite in version control (e.g., Git). +- Ensure tests are updated as the API evolves (versioning, deprecations). + +### 🔁 11. Chain Requests for Workflow Validation + +- Simulate real-world flows (e.g., user signup → login → perform action). +- Maintain session or token data across calls. + +### 📊 12. Add Clear Logging and Reporting + +- Output test name, request payload, status code, and failure reason. +- Use structured reports for better traceability in CI/CD tools. diff --git a/versioned_docs/version-3.0.0/running-keploy/test-generate.md b/versioned_docs/version-3.0.0/running-keploy/test-generate.md new file mode 100644 index 000000000..3ccc34dec --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/test-generate.md @@ -0,0 +1,76 @@ +--- +id: test-generate +title: What is API testing? +sidebar_label: Generate Tests +description: This section documents what is API Testing and why we need it +tags: + - API testing + - API mocks + - generate test cases + - test automation +keywords: + - api testing + - api mocks + - automated testing + - ai testing + - keploy + - Gemini + - OpenAI +--- + +# 🧪 AI-Powered API Test Suite Generation + +Keploy enables you to automatically generate **comprehensive API test suites** for your application using AI, based on live requests, API schemas, and supporting documentation. + +## 🚀 Create API Tests in 4 Simple Steps + +### 1️⃣ Create a New App + +Start by creating a new test project for your application: + +- Click on **"Create New App"** +- Give it a name that matches your app/module +- Optionally provide a description + +### 2️⃣ Input URL or Endpoint + +Provide a base URL or a specific API endpoint you want to test: + +This helps Keploy identify where the API requests are sent and initiate context-aware test generation. + +### 3️⃣ Add Test Inputs + +#### 🔐 Authentication (Optional) + +If your API requires authentication, make sure you: + +- Add API keys or bearer tokens in headers +- Or include auth flows via test inputs below + +#### 📎 Paste cURL Snippets _(Recommended: 3–5)_ + +Add working `curl` commands representing real user flows. These help the AI infer request types, payloads, and expected outcomes. + +```bash +curl -X POST https://your-api.com/login -d 'username=john&password=secret' + +curl -X GET https://your-api.com/users + +curl -X PUT https://your-api.com/users/1 -d 'username=john&role=admin' +``` + +### 📄 Swagger / OpenAPI Schema + +Paste your OpenAPI (Swagger) spec in either **YAML** or **JSON** format. +This schema provides a contract for how endpoints behave and enables accurate, schema-driven test generation. + +### 4️⃣ Upload Supporting Resources (Optional but Valuable) + +Enhance test accuracy by uploading documentation such as: + +- 🧾 **API Docs** (Postman collections, Swagger files) +- 💻 **Code Snippets** +- 📄 **PRD/BRD documents** +- 🗂 **Feature briefs or requirement docs** + +These help Keploy better understand the intended logic and behavior of each endpoint. diff --git a/versioned_docs/version-3.0.0/running-keploy/test-run-reports.md b/versioned_docs/version-3.0.0/running-keploy/test-run-reports.md new file mode 100644 index 000000000..91a3ddc8a --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/test-run-reports.md @@ -0,0 +1,118 @@ +--- +id: test-run-reports +title: What is API testing? +sidebar_label: Test Report generation +description: This section documents what is API Testing and why we need it +tags: + - API testing + - API mocks + - generate test cases + - test automation +keywords: + - api testing + - api mocks + - automated testing + - ai testing + - keploy + - Gemini + - OpenAI +--- + +# 🧪 Keploy Test Run Reports + +Easily track and manage the outcome of your API test runs with detailed reporting on test executions, results, and creators. + +## 🔍 Search Test Run Reports + +Use the search bar to filter reports by Report ID, creator email, or status. + +### 📋 Test Report Summary + +- Report ID +- Created At +- Creator +- Total Tests +- Passed +- Failed +- Status + +## 🧩 Test Suites + +Manage and fine-tune your test suites for each API endpoint. You can edit request inputs, response expectations, and assertion types. + +### ✏️ Editable Test Cases + +Each test case can be modified to: + +- Change the **request payload**, headers, or query parameters +- Edit or update **expected response bodies** +- Select or modify **assertion types** + +### 🧪 Supported Assertion Types + +| Assertion Type | Description | +| ------------------ | -------------------------------------------------------------- | +| `statusCode` | Asserts the HTTP status code matches expected (e.g., 200, 404) | +| `bodyContains` | Checks if the response body includes specific text or keys | +| `jsonEquals` | Validates deep equality of the JSON response | +| `headerMatch` | Asserts presence or value of specific response headers | +| `schemaValidation` | Validates against OpenAPI/JSON schema if available | +| `custom` | User-defined scripts or match rules | + +#### ➕ Example Test Case Structure (YAML) + +```yaml +- testName: Get All Users + method: GET + endpoint: /users + expectedStatus: 200 + assertions: + - type: statusCode + - type: bodyContains + value: "username" + - type: jsonEquals + expected: + - id: 1 + username: john_doe +``` + +### 🧱 Edit Test Step + +Easily customize individual test steps to simulate real-world API usage and validate your app’s behavior under different conditions. + +#### 🔧 Request Details + +Update the request configuration for each test case: + +- **Name:** + `Create Object P024 Invalid JSON` + +- **Method:** + `POST` + +- **URL Path:** + `/objects` + +- **Headers:** + + | Key | Value | + | ------------ | ---------------- | + | Content-Type | application/json | + + You can **Add Header** as needed (e.g., Authorization, Custom-Token). + +- **Request Body:** + + ````json + { + "name": "AUT Test Object P024", + "data": { + "key": "value" + } + }``` + ```` + +### 💾 Actions + +- ✅ **Save Changes** — Apply edits to the test step and update the suite. +- ❌ **Cancel** — Discard any unsaved modifications and revert to the last saved state. diff --git a/versioned_docs/version-3.0.0/running-keploy/unit-test-architecture.md b/versioned_docs/version-3.0.0/running-keploy/unit-test-architecture.md new file mode 100644 index 000000000..17822b77a --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/unit-test-architecture.md @@ -0,0 +1,38 @@ +--- +id: unit-test-architecture +title: Behind the Scenes +sidebar_label: Behind the Scenes +description: How Keploy's AI-powered unit testing architecture works. +tags: + - unit testing + - architecture + - AI + - workflow +--- + +# 🏗️ Unit Testing Architecture + +Unit testing at scale isn’t just about writing individual test cases—it's about building a workflow that can generate, filter, and review tests with minimal manual effort. +Here’s how Keploy leverages AI (LLM) to automate and streamline the unit testing process: + +![Keploy Unit Testing Architecture](https://res.cloudinary.com/dfhtr1rwo/image/upload/v1748780535/keploy-utg-arch_rv2rhz.png) + +> _This diagram shows the end-to-end workflow of Keploy’s AI-powered unit testing architecture._ + +--- + +## How it Works (at a Glance) + +- **CI Issues as Input:** The process starts with issues detected by your CI pipeline. +- **LLM Generates Faults:** The system uses AI to create possible faults based on your code and current issues. +- **Build & Test:** It checks if these faults build and whether they pass or fail. +- **Filter & Deduplicate:** Syntactically identical or equivalent faults are removed automatically. +- **Test Generation:** For unique faults, the LLM creates tests specifically designed to catch those faults. +- **Automated Review:** Tests are auto-validated—discarding unstable or irrelevant ones. +- **Diff Summary & Test Plan:** The final tests and summaries are generated automatically, then passed to your PR Agent for CI review. + +--- + +## In Short + +Keploy’s AI-driven architecture turns CI feedback and your codebase into a robust, scalable set of unit tests—saving you hours and catching regressions before they hit production. diff --git a/versioned_docs/version-3.0.0/running-keploy/unit-test-generator.md b/versioned_docs/version-3.0.0/running-keploy/unit-test-generator.md index 97bcc77ac..7c30cae01 100644 --- a/versioned_docs/version-3.0.0/running-keploy/unit-test-generator.md +++ b/versioned_docs/version-3.0.0/running-keploy/unit-test-generator.md @@ -1,7 +1,7 @@ --- id: unit-test-generator title: Keploy Unit Test Generator -sidebar_label: Unit Test Generator +sidebar_label: Introduction description: This section documents usecase of Keploy's Unit Test Generator tags: - utg @@ -19,149 +19,18 @@ keywords: - OpenAI --- -Keploy's unit test generator(ut-gen) implementation of Meta LLM research paper is a first which understands code semantics and generates meaningful unit tests, aiming to: +Keploy's Unit Test Generator (UTG) simplifies testing by generating high-quality, maintainable unit tests with minimal manual effort. Inspired by Meta’s LLM research, it uses code semantics and Large Language Models (LLMs) to produce meaningful test cases. -- **Automate unit test generation (UTG):** Quickly generate comprehensive unit tests and reduce the redundant manual effort. +To fit into modern development workflows, Keploy now supports multiple methods for unit test generation - ranging from automated pull request comments to a one-click VS Code extension -- **Improve edge cases:** Extend and improve the scope of tests to cover more complex scenarios that are often missed manually. +Keploy's UTG aims to: -- **Boost test coverage:** As codebase grows, ensuring exhaustive coverage should become feasible. +- **Automate unit test generation:** Reduce manual effort by generating tests automatically. +- **Improve edge case coverage:** Catch complex scenarios often missed manually. +- **Boost test coverage:** Make comprehensive coverage achievable as your codebase grows. -## Usage +### Try the Unit Test Generator in two ways: -```bash -keploy gen [flag] -``` +1. **PR Agent**: Install a GitHub App on your repo to automatically generate tests when you create a pull request. -## Prerequisites - -`API KEY` of the AI model is needed, this can be from either of one these: - -- **OpenAI's [GPT-4o](https://platform.openai.com/) [preferred].** -- Alternative LLMs via [litellm](https://github.com/BerriAI/litellm?tab=readme-ov-file#quick-start-proxy---cli). -- [Azure OpenAI](https://azure.microsoft.com/en-in/products/ai-services/openai-service) Services - -Now, let's setup the `API_KEY` as environment variable : - - -```bash -export API_KEY=xxxx -``` - -## Running with Javascript/TypeScript applications - -For the we need to make sure that the coverage report is in coberuta format, so to make sure let's modify our `package.json` by adding : - -```json -"jest": { - "coverageReporters": ["text", "cobertura"], - } -``` - -or if `jest.config.js` is present then, we need to add : - -```js -module.exports = { - coverageReporters: ["text", "cobertura"], -}; -``` - -### Generating Unit Tests - -You can test a smaller section of application or to control costs, we can consider generating tests for a single source and its corresponding test file : - - -```bash -keploy gen --source-file-path="" \ - --test-file-path="" \ - --test-command="npm test" \ - --coverage-report-path="" -``` - -For Entire Application we can generate tests by using `--test-dir` instead of `--test-file-path`. - -> ⚠️ Warning: Executing command with `--test-dir` will generate unit tests for all files in the application. Depending on the size of the codebase, this process may take between 20 minutes to an hour and will incur costs related to LLM usage. - -#### Example - -Let us consider the [express-mongoose](https://github.com/keploy/samples-typescript/tree/main/express-mongoose) sample-application, where we have a jest testcases under `test` folder with name `routes.test.js`. - -We have modified our `package.json` by adding below : - - -```json - "jest": { - "collectCoverage": true, - "coverageReporters": ["text", "cobertura"], - "coverageDirectory": "./coverage" - } -``` - -Now let's run Keploy UTG command : - - -```bash -keploy gen \ - --source-file-path="./src/routes/routes.js" \ - --test-file-path="./test/routes.test.js" \ - --test-command="npm test" \ - --coverage-report-path="./coverage/cobertura-coverage.xml" -``` - -We will get following output : - - -Keploy test coverage with ai generated unit tests for express-mongoose - -_Voila!! The Generated Testcases have provided with 58% coverage🌟_ - -## Running with Golang applications - -To ensure Cobertura formatted coverage reports, we need to install the following : - - -```bash -go install github.com/axw/gocov/gocov@v1.1.0 -go install github.com/AlekSi/gocov-xml@v1.1.0 -``` - -### Generating Unit Tests - -With the above dependecies installed, we can now generate tests for our application by the following dommand : - - -```bash -keploy gen --source-file-path="o" \ - --test-file-path="" \ - --test-command="go test -v ./... -coverprofile=coverage.out && gocov convert coverage.out | gocov-xml > coverage.xml" \ - --coverage-report-path="" -``` - -For Entire Application we can generate tests by using `--test-dir` instead of `--test-file-path`. - -> ⚠️ Warning: Executing command with `--test-dir` will generate unit tests for all files in the application. Depending on the size of the codebase, this process may take between 20 minutes to an hour and will incur costs related to LLM usage. - -#### Example - -Let us consider the [mux-sql](https://github.com/keploy/samples-go/tree/main/mux-sql/) sample-application, where we already have our `app_test.go` test file for `app.go` source file : - - -```bash -keploy gen --source-file-path="app.go" \ - --test-file-path="app_test.go" \ - --test-command="go test -v ./... -coverprofile=coverage.out && gocov convert coverage.out | gocov-xml > coverage.xml" \ - --coverage-report-path="./coverage.xml" -``` - -We will get following output : - - -Keploy test coverage with ai generated unit test for mux-sql - -_Voila!! The Generated Testcases have provided with 71% coverage in just 2 iterations 🌟_ - -## Frequently Asked Questions(FAQs) - -1. **What is Keploy's Unit Test Generator (UTG)?**
- - Keploy's UTG automates the creation of unit tests based on code semantics, enhancing test coverage and reliability. -2. **Does Keploy send your private data to any cloud server for test generation?**
- - No, Keploy does not send any user code to remote systems, except when using the unit test generation feature. When using the UT gen feature, only the source code and the unit test code will be sent to the Large Language Model (LLM) you are using. By default, Keploy uses - litellm to support vast number of LLM backends. Yes, if your organization has its own LLM(a private one), you can use it with Keploy. This ensures that data is not sent to any external systems. -3. **How does Keploy contribute to improving unit test coverage?**
- - By providing a zero code platform for automated testing, Keploy empowers developers to scale up their unit test coverage without extensive coding knowledge. This integration enhances testing reports, ultimately boosting confidence in the product's quality. -4. **Is Keploy cost-effective for automated unit testing?**
- - Yes, Keploy optimizes costs by automating repetitive testing tasks and improving overall test efficiency. -5. **How does Keploy generate coverage reports?**
- - Keploy generates detailed Cobertura format reports, offering insights into test effectiveness and code quality. -6. **Can Keploy handle large codebases efficiently?**
- - Yes, Keploy is designed to handle large codebases efficiently, though processing time may vary based on project size and complexity. +2. **VS Code Extension**: Generate test files with a single click directly from your IDE. diff --git a/versioned_docs/version-3.0.0/running-keploy/utg-pr-agent.md b/versioned_docs/version-3.0.0/running-keploy/utg-pr-agent.md new file mode 100644 index 000000000..2a567612f --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/utg-pr-agent.md @@ -0,0 +1,95 @@ +--- +id: utg-pr-agent +title: Keploy's PR Agent +sidebar_label: PR Agent +description: This section documents usecase of Keploy's Unit Test Generator Pull Request Agent +tags: + - utg + - unit test generator + - unit test generator pull request agent + - unit test generator pr agent + - generate unit test + - unit test +keywords: + - unit test generator + - unit testing + - unit tests + - documentation + - testcases + - AI testing + - Gemini + - OpenAI +--- + +> **Transform your code review process with intelligent, automated unit test generation that ensures every PR is backed by comprehensive test coverage.** + +Keploy's **PR Agent** is a revolutionary GitHub App that seamlessly integrates into your pull request workflow, automatically generating high-quality unit tests for every code change. By embedding intelligent test generation directly into your GitHub PRs, this tool eliminates manual testing overhead and ensures that quality code and comprehensive tests go hand in hand **before anything reaches production**. + +## **Quick Setup Guide** + +Follow the steps below to get started with the Keploy PR Agent on your GitHub repository: + +### Step 1. Install the Keploy GitHub App + +- Visit [Github Marketplace](https://github.com/marketplace/keploy) + + + +Click on **Add**. + +Choose: + +- A **specific repository** where you want to enable the PR agent, or +- **All repositories** if you want the functionality across your GitHub organization. +- Authorize the app to complete the installation. + + + +### Step 2. Make a Code Change and Open a Pull Request + +Once the app is installed: + +- Make any code changes in your repository. +- Push your changes and **create a pull request (PR)** as usual. +- The **Keploy PR Agent** will automatically detect the changes and leave a comment on the PR. + + + +### Step 3. Trigger Unit Test Generation + +In the PR comment left by Keploy: + +- Click on the link. +- You will be redirected to the Keploy service, where the unit test generation process begins. +- The PR Agent uses code semantics and the power of LLMs to understand your code changes and generate meaningful unit tests. + + + +### Step 4. View the Generated Tests and Summary + +Once the process is complete: + +- Click **"Go back to the PR"**. +- The PR comment will be updated with: + - All the **unit test files** generated for your recent changes. + - A **test summary** presented in a **clean tabular format** showing: - File names - Number of test cases - Coverage details - Edge cases handled (if any) + + + You can review, modify, or directly merge the PR with complete confidence that your changes are well-tested. + With Keploy PR Agent, testing is no longer a bottleneck - it’s built right into your workflow. + +## **Get Started Today** + +Ready to transform your pull request workflow from a potential quality bottleneck into a quality amplifier? Install the Keploy PR Agent and experience the future of collaborative development. + +### **Next Steps:** + +1. **Install the PR Agent** in under 10 seconds +2. **Create a test PR** to see the magic in action +3. **Experience the difference** in your next code review cycle + +_Elevate your development workflow. Make every pull request a quality checkpoint._ + +import GetSupport from '../concepts/support.md' + + diff --git a/versioned_docs/version-3.0.0/running-keploy/utg-vsc-extension.md b/versioned_docs/version-3.0.0/running-keploy/utg-vsc-extension.md new file mode 100644 index 000000000..b979e461f --- /dev/null +++ b/versioned_docs/version-3.0.0/running-keploy/utg-vsc-extension.md @@ -0,0 +1,131 @@ +--- +id: utg-vscode-extension +title: Keploy's VS Code Extension +sidebar_label: VS Code Extension +description: This section documents usecase of Keploy's AI powered unit test vs code extension +tags: + - utg + - unit test generator + - unit test generator pull request agent + - unit test generator pr agent + - generate unit test + - unit test +keywords: + - unit test generator + - unit testing + - unit tests + - documentation + - testcases + - AI testing + - Gemini + - OpenAI +--- + +> **Transform your IDE into a testing powerhouse. Generate comprehensive, intelligent unit tests with a single click - trusted by 500K+ developers worldwide.** + +The **Keploy Unit Test Generator VS Code Extension** revolutionizes how developers approach testing by bringing seamless, AI-powered test generation directly into your favorite IDE. Whether you're building new features, debugging complex issues, or refactoring legacy code, generate production-ready unit tests instantly without leaving your development environment. + +## **Why 500K+ Developers Choose Keploy** + +### **Instant Productivity Boost** + +- **One-Click Generation**: Transform any function into a comprehensive test suite in seconds +- **Zero Context Switching**: Stay in your IDE flow without opening external tools +- **Intelligent Analysis**: AI understands your code's business logic and generates relevant test scenarios + +### **Enterprise-Grade Quality** + +- **LLM-Powered Intelligence**: Leverages GPT-4o and advanced language models for superior test quality +- **Framework Agnostic**: Works seamlessly with Jest, Mocha, JUnit, pytest, and more +- **Production Ready**: Generated tests follow industry best practices and your project's conventions + +## **Generate Tests in Simple Steps** + +### 1. Install the Extension + +You can install the Keploy extension using either of the following methods: + +**Method 1: From VS Code Marketplace** + +- Open the **Extensions** tab in VS Code. +- Search for **"Keploy"**. +- Click **Install**. + + + + +**Method 2: Direct Link / VS Code Marketplace** + +- Visit [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=Keploy.keployio). +- Click **Install** and follow the prompts to open it in VS Code. + + + + +### 2. Generate Unit Tests in a Single Click + +Once the extension is installed: + +1. **Look for the Keploy icon** in the **Activity Bar** (left-hand sidebar) of VS Code. +2. Click the **Keploy icon** to open the extension UI. +3. You’ll see a simple interface with a button labeled **“Generate Unit Tests.”** +4. Click the button - that’s it! + + + +Keploy will analyze your codebase and automatically generate all relevant unit test files, covering: + +- Core logic +- Edge cases +- Boundary conditions +- And more - all with meaningful assertions and clean test structure. + +## What Happens Next? + +After clicking **Generate Unit Tests**, Keploy will: + +- Parse and understand your source code using code semantics. +- Create relevant test files alongside your existing code (in your test directory or alongside source files, depending on your config). +- Provide complete test coverage with little to no boilerplate code. + + + + +All tests are: + +- Readable +- Maintainable +- Ready to run using your preferred test runner (e.g., Jest, Mocha, etc.) + +## **Smart Output Management** + +### **Intelligent Directory Structure** + +Generated tests are organized following best practices: + +``` +your-project/ +├── src/ +│ └── utils/ +│ └── calculator.js +└── tests/ + └── utils/ + └── calculator.test.js +``` + +## **Get Started Today** + +Don't let testing slow down your development velocity. With Keploy's AI-powered VS Code extension, comprehensive test coverage is just one click away. + +### **Quick Start:** + +1. **[Install from VS Code Marketplace →](https://marketplace.visualstudio.com/items?itemName=Keploy.keployio)** +2. **Open your favorite project** and select a function +3. **Click "Generate Unit Tests"** and experience the magic +4. **Watch your test coverage soar** while maintaining development speed + +_Transform your IDE. Elevate your code quality. Join 500k+ developers building better software with Keploy._ + +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 ca39eba2f..32cf6eb63 100644 --- a/versioned_sidebars/version-2.0.0-sidebars.json +++ b/versioned_sidebars/version-2.0.0-sidebars.json @@ -162,12 +162,12 @@ "collapsible": true, "collapsed": true, "items": [ + "keploy-explained/faq", + "keploy-explained/common-errors", "dependencies/mongo", "dependencies/postgres", "dependencies/http", - "dependencies/redis", - "keploy-explained/faq", - "keploy-explained/common-errors" + "dependencies/redis" ] } ], diff --git a/versioned_sidebars/version-3.0.0-sidebars.json b/versioned_sidebars/version-3.0.0-sidebars.json index eb6bf440e..6a81c03ef 100644 --- a/versioned_sidebars/version-3.0.0-sidebars.json +++ b/versioned_sidebars/version-3.0.0-sidebars.json @@ -2,17 +2,46 @@ "sidebarExplanation": [ { "type": "category", - "label": "Overview", + "label": "Unit Testing", + "collapsed": false, "items": [ - "keploy-explained/introduction", - "keploy-explained/how-keploy-works", - "keploy-explained/why-keploy" + "running-keploy/about-unit-testing", + { + "type": "category", + "label": "Integration", + "items": [ + "running-keploy/utg-pr-agent", + "running-keploy/utg-vscode-extension", + "keploy-explained/integrations-pr-agent" + ] + }, + { + "type": "category", + "label": "FAQs", + "items": [ + "keploy-explained/keploy-security", + "keploy-explained/keploy-privacy", + "keploy-explained/ai-models", + "keploy-explained/supported-languages", + "keploy-explained/unit-testing-faq" + ] + } ] }, { "type": "category", - "label": "Integration Testing (Open Source + Enterprise)", + "label": "Integration Testing", + "collapsed": false, "items": [ + { + "type": "category", + "label": "Explanation", + "items": [ + "keploy-explained/introduction", + "keploy-explained/how-keploy-works", + "keploy-explained/why-keploy" + ] + }, { "type": "doc", "label": "Installation", @@ -20,7 +49,7 @@ }, { "type": "category", - "label": "Running Keploy", + "label": "Running Guide", "items": [ "running-keploy/cli-commands", "running-keploy/rename-testcases", @@ -32,130 +61,160 @@ }, { "type": "category", - "label": "Test Coverage & SDKs", + "label": "CI/CD Integration", "items": [ - "server/sdk-installation/go", - "server/sdk-installation/java", - "server/sdk-installation/javascript", - "server/sdk-installation/python" + "ci-cd/github", + "ci-cd/gitlab", + "ci-cd/jenkins" ] }, { "type": "category", - "label": "CI/CD Integration", + "label": "Test Coverage Integration", "items": [ - "ci-cd/github", - "ci-cd/gitlab", - "ci-cd/jenkins" + "server/sdk-installation/go", + "server/sdk-installation/java", + "server/sdk-installation/javascript", + "server/sdk-installation/python" ] }, { "type": "category", - "label": "Quickstarts", + "label": "QuickStarts", + "collapsible": true, + "collapsed": true, "items": [ { - "type": "doc", - "label": "Overview", - "id": "quickstart/overview" + "type": "category", + "label": "Java (SpringBoot)", + "collapsible": true, + "collapsed": true, + "items": [ + "quickstart/openhospital", + "quickstart/pet-clinic", + "quickstart/samples-java", + "quickstart/java-spring-boot-mongo", + "quickstart/java-spring-boot-xml" + ] + }, + { + "type": "category", + "label": "Golang", + "collapsible": true, + "collapsed": true, + "items": [ + "quickstart/samples-echo", + "quickstart/samples-gin", + "quickstart/samples-redis", + "quickstart/samples-mux", + "quickstart/samples-mysql", + "quickstart/samples-fasthttp" + ] + }, + { + "type": "category", + "label": "Python", + "collapsible": true, + "collapsed": true, + "items": [ + "quickstart/samples-django", + "quickstart/samples-flask", + "quickstart/samples-fastapi", + "quickstart/samples-fastapi-twilio", + "quickstart/sanic-mongo", + "quickstart/flask-redis" + ] + }, + { + "type": "category", + "label": "Javascript", + "collapsible": true, + "collapsed": true, + "items": [ + "quickstart/samples-bunjs", + "quickstart/samples-nextjs", + "quickstart/samples-nodejs", + "quickstart/samples-node-jwt", + "quickstart/crud-nodejs", + "quickstart/express-postgresql-prisma", + "quickstart/samples-typescript" + ] + }, + { + "type": "category", + "label": "Rust", + "collapsible": true, + "collapsed": true, + "items": [ + "quickstart/samples-rust", + "quickstart/sample-rust-crud-mongo" + ] + }, + { + "type": "category", + "label": "C# (.NET Core)", + "collapsible": true, + "collapsed": true, + "items": ["quickstart/samples-csharp"] } ] }, { "type": "category", - "label": "Enterprise Features", + "label": "Keploy Enterprise", "items": [ "keploy-cloud/cloud-installation", "keploy-cloud/time-freezing", "keploy-cloud/mock-registry", "keploy-cloud/keploy-console", "keploy-cloud/auto-test-generation", - "keploy-cloud/deduplication" + "keploy-cloud/deduplication", + "keploy-explained/common-errors", + "keploy-explained/integration-testing-faq" ] } ] }, { "type": "category", - "label": "Unit Testing Agent (Paid)", - "items": [ - "running-keploy/unit-test-generator", - { - "type": "doc", - "label": "How it works", - "id": "unit-test/overview" - }, - { - "type": "doc", - "label": "GitHub Setup", - "id": "unit-test/setup" - }, - { - "type": "doc", - "label": "Custom Models", - "id": "unit-test/custom-models" - }, - { - "type": "doc", - "label": "LLM Support", - "id": "unit-test/llms" - } - ] - }, - { - "type": "category", - "label": "API Test Generation (Paid)", + "label": "API Testing", + "collapsed": false, "items": [ + "running-keploy/about-api-testing", + "running-keploy/api-test-generator", + "running-keploy/test-generate", + "running-keploy/test-run-reports", { - "type": "doc", - "label": "Getting Started", - "id": "api-test-gen/intro" - }, - { - "type": "doc", - "label": "Upload Schema or Collection", - "id": "api-test-gen/upload" - }, - { - "type": "doc", - "label": "Advanced Options (Edge cases, flows)", - "id": "api-test-gen/advanced" + "type": "category", + "label": "Operations", + "items": [ + "running-keploy/best-practices-api-testing", + "operation/web-ui-operations" + ] }, { "type": "doc", - "label": "Self-Healing & Replay", - "id": "api-test-gen/self-healing" + "label": "CI/CD Integration", + "id": "ci-cd/github" }, - { - "type": "doc", - "label": "Running Tests in CI", - "id": "api-test-gen/ci" - } - ] - }, - { - "type": "category", - "label": "Resources & Community", - "items": [ - "keploy-explained/faq", - "keploy-explained/common-errors", - "dependencies/mongo", - "dependencies/postgres", - "dependencies/http", - "dependencies/redis", { "type": "category", - "label": "Hacktoberfest'24", + "label": "FAQs", "items": [ - "hacktoberfest/contribution-guide", - "hacktoberfest/code-contribution", - "hacktoberfest/no-code-contribution" + "keploy-explained/keploy-security", + "keploy-explained/keploy-privacy", + "keploy-explained/ai-models", + "keploy-explained/api-testing-faq" ] } ] - }, + } + ], + "sidebarContributionGuide": [ { "type": "category", "label": "Contribute", + "collapsible": true, "items": [ "keploy-explained/contribution-guide", "keploy-explained/docs-dev-guide", @@ -165,4 +224,4 @@ ] } ] -} \ No newline at end of file +} From d9f5b95cbf0effb52eee26d7cc1e364e76362f4f Mon Sep 17 00:00:00 2001 From: Soumyodeep-Das Date: Wed, 18 Jun 2025 21:06:45 +0530 Subject: [PATCH 2/4] issue #2769: implemented mega menu drop down with transparent background Signed-off-by: Soumyodeep-Das --- docusaurus.config.js | 124 +++++----- src/theme/Navbar/index.js | 371 +++++++++++++++++++++++++++++ src/theme/hooks/useThemeContext.js | 59 +++++ 3 files changed, 492 insertions(+), 62 deletions(-) create mode 100644 src/theme/Navbar/index.js create mode 100644 src/theme/hooks/useThemeContext.js diff --git a/docusaurus.config.js b/docusaurus.config.js index de0cf1b20..4a58b1a22 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -107,68 +107,68 @@ module.exports = { additionalLanguages: ["java", "ruby", "php", "bash"], }, // hideableSidebar: true, - navbar: { - hideOnScroll: false, - logo: { - alt: "Keploy logo", - src: "img/keploy-logo-dark.svg", - srcDark: "img/keploy-logo-dark.svg", - }, - items: [ - { - label: "Products", - position: "left", - items: [ - { - label: "Unit Testing", - to: "/running-keploy/utg-pr-agent/", - }, - { - label: "Integration Testing", - to: "/keploy-explained/introduction", - }, - { - label: "API Testing", - to: "/running-keploy/about-api-testing", - }, - ], - }, - { - label: "Blog", - items: [ - { - label: "Tech Blogs", - href: "https://keploy.io/blog/technology", - }, - { - label: "Communtity Articles", - href: "https://keploy.io/blog/community", - }, - { - label: "Glossary", - href: "/concepts/reference/glossary/", - }, - ], - position: "left", - }, - { - to: "/keploy-explained/contribution-guide", - label: "Contribution Guide", - position: "left", - }, - { - type: "docsVersionDropdown", - position: "right", - dropdownActiveClassDisabled: true, - }, - { - href: "https://github.com/keploy/keploy", - position: "right", - className: "header-github-link", - "aria-label": "GitHub repository", - }, - ], - }, + // navbar: { + // hideOnScroll: false, + // logo: { + // alt: "Keploy logo", + // src: "img/keploy-logo-dark.svg", + // srcDark: "img/keploy-logo-dark.svg", + // }, + // items: [ + // { + // label: "Products", + // position: "left", + // items: [ + // { + // label: "Unit Testing", + // to: "/running-keploy/utg-pr-agent/", + // }, + // { + // label: "Integration Testing", + // to: "/keploy-explained/introduction", + // }, + // { + // label: "API Testing", + // to: "/running-keploy/about-api-testing", + // }, + // ], + // }, + // { + // label: "Blog", + // items: [ + // { + // label: "Tech Blogs", + // href: "https://keploy.io/blog/technology", + // }, + // { + // label: "Communtity Articles", + // href: "https://keploy.io/blog/community", + // }, + // { + // label: "Glossary", + // href: "/concepts/reference/glossary/", + // }, + // ], + // position: "left", + // }, + // { + // to: "/keploy-explained/contribution-guide", + // label: "Contribution Guide", + // position: "left", + // }, + // { + // type: "docsVersionDropdown", + // position: "right", + // dropdownActiveClassDisabled: true, + // }, + // { + // href: "https://github.com/keploy/keploy", + // position: "right", + // className: "header-github-link", + // "aria-label": "GitHub repository", + // }, + // ], + // }, footer: { copyright: ` diff --git a/src/theme/Navbar/index.js b/src/theme/Navbar/index.js new file mode 100644 index 000000000..64f906255 --- /dev/null +++ b/src/theme/Navbar/index.js @@ -0,0 +1,371 @@ +import React, { useState, useRef } from 'react'; +import Link from '@docusaurus/Link'; +import useThemeContext from '../hooks/useThemeContext'; + +const navItems = [ + { + label: 'Products', + megaMenu: [ + { + title: 'Unit Testing', + description: 'Generate unit tests with mocks in seconds', + image: 'https://keploy.io/_next/static/media/unit-test.c96bb42c.svg', + href: '/docs/server/installation/', + height: '280px', + width: '340px', + }, + { + title: 'API Testing', + description: 'Automatically record, replay, and validate APIs', + image: 'https://keploy.io/_next/static/media/api-test.c9383d11.svg', + href: '/docs/running-keploy/about-api-testing/', + height: '280px', + width: '340px', + }, + { + title: 'Integration Testing', + description: 'Open-source testing infrastructure for devs', + image: 'https://keploy.io/_next/static/media/integration-test.842196d5.svg', + href: '/docs/keploy-explained/introduction/', + height: '280px', + width: '340px', + }, + ], + }, + { + label: 'Solutions', + megaMenu: [ + { + title: 'Code Coverage', + image: 'https://keploy.io/_next/static/media/code-coverages.2e8db773.svg', + href: 'https://keploy.io/code-coverage', + height: '180px', + width: '240px', + }, + { + title: 'Developer Productivity', + image: 'https://keploy.io/_next/static/media/developer-productivity.093de83a.svg', + href: 'https://keploy.io/developer-productivity', + height: '180px', + width: '240px', + }, + { + title: 'CI Pipelines', + image: 'https://keploy.io/_next/static/media/ci-cd.aebe9002.svg', + href: 'https://keploy.io/docs/ci-cd/github/', + height: '180px', + width: '240px', + }, + ], + }, + { + label: 'Developers', + megaMenu: [ + { + title: 'Docs', + image: 'https://keploy.io/_next/static/media/doc.66b286fa.svg', + href: 'https://keploy.io/docs/', + height: '160px', + width: '200px', + }, + { + title: 'Technical Blog', + image: 'https://keploy.io/_next/static/media/blogs.38596f15.svg', + href: 'https://keploy.io/blog', + height: '160px', + width: '200px', + }, + { + title: 'Community Stories', + image: 'https://keploy.io/_next/static/media/community.d62a63d8.svg', + href: 'https://www.g2.com/products/keploy/reviews', + height: '160px', + width: '200px', + }, + { + title: 'Tutorials', + image: 'https://keploy.io/_next/static/media/tutorials.7666a675.svg', + href: 'https://www.youtube.com/playlist?list=PLuImHQnqnB_b3MbF1_873XeMhXkaZPpwV', + height: '160px', + width: '200px', + }, + { + title: 'Migration Guide', + image: 'https://keploy.io/_next/static/media/migration.8de1314d.svg', + href: 'https://keploy.io/blog/technology/migration-guide-from-restassured-to-keploy', + height: '160px', + width: '200px', + }, + ], + }, + { label: 'Pricing', href: 'https://keploy.io/pricing' }, + { + label: 'Resources', + megaMenu: [ + { + title: 'About Us', + image: 'https://keploy.io/_next/static/media/about-us.e6182882.svg', + href: 'https://keploy.io/about', + height: '140px', + width: '180px', + }, + { + title: 'Events', + image: 'https://keploy.io/_next/static/media/events.8cfbfeeb.svg', + href: 'https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ2l-psdTCNCLYAJ-Jt5ESyGP7gi1_U70ySTjtFNr0Kmx5UagNJnyzg7lNjA3NKnaP6qFfpAgcdZ', + height: '140px', + width: '180px', + }, + { + title: 'Partner With Us', + image: 'https://keploy.io/_next/static/media/partner-with-us.d899cd43.svg', + href: 'https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ2l-psdTCNCLYAJ-Jt5ESyGP7gi1_U70ySTjtFNr0Kmx5UagNJnyzg7lNjA3NKnaP6qFfpAgcdZ', + height: '140px', + width: '180px', + }, + { + title: 'Contact Us', + image: 'https://keploy.io/_next/static/media/contact.8d4fbcb2.svg', + href: 'https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ2l-psdTCNCLYAJ-Jt5ESyGP7gi1_U70ySTjtFNr0Kmx5UagNJnyzg7lNjA3NKnaP6qFfpAgcdZ', + height: '140px', + width: '180px', + }, + { + title: 'Community Forum', + image: 'https://keploy.io/_next/static/media/community-forum.f92d4c5e.svg', + href: 'https://github.com/keploy', + height: '140px', + width: '180px', + }, + ], + }, +]; + +const rightIcons = [ + { + icon: '/img/vscode.svg', + label: 'VS Code', + value: '543K', + href: 'https://marketplace.visualstudio.com/items?itemName=keploy.keploy', + }, + { + icon: '/img/github.svg', + label: 'GitHub', + value: '10.2K', + href: 'https://github.com/keploy/keploy', + }, +]; + +const versions = [ + { + label: '3.0.0', + href: 'https://keploy.io/docs/server/installation/', + }, + { + label: '2.0.0', + href: 'https://keploy.io/docs/2.0.0/server/installation/', + }, + { + label: '1.0.0', + href: 'https://keploy.io/docs/1.0.0/keploy-explained/introduction/', + }, +]; + +function ThemeToggle() { + const { isDarkTheme, setLightTheme, setDarkTheme } = useThemeContext(); + return ( + + ); +} + +function VersionDropdown() { + const [open, setOpen] = useState(false); + return ( +
+ + {open && ( +
+ {versions.map((v) => ( + + {v.label} + + ))} +
+ )} +
+ ); +} + +function GithubIcon() { + return ( + + ); +} + +function KeployLogo() { + return ( + + print 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} + +export default function Navbar() { + const [openMenu, setOpenMenu] = useState(null); + const { isDarkTheme } = useThemeContext(); + const timeoutRef = useRef(null); + + const handleMouseEnter = (label) => { + if (timeoutRef.current) { + clearTimeout(timeoutRef.current); + } + setOpenMenu(label); + }; + + const handleMouseLeave = () => { + timeoutRef.current = setTimeout(() => { + setOpenMenu(null); + }, 300); // 300ms delay before hiding + }; + + return ( + + ); +} diff --git a/src/theme/hooks/useThemeContext.js b/src/theme/hooks/useThemeContext.js new file mode 100644 index 000000000..fada4d388 --- /dev/null +++ b/src/theme/hooks/useThemeContext.js @@ -0,0 +1,59 @@ +import { useEffect, useState } from 'react'; + +// Helper to get current theme from document or localStorage +function getCurrentTheme() { + if (typeof window !== 'undefined') { + const stored = localStorage.getItem('theme'); + if (stored === 'dark') return true; + if (stored === 'light') return false; + // fallback to document attribute + return document.documentElement.getAttribute('data-theme') === 'dark'; + } + return false; +} + +export default function useThemeContext() { + const [isDarkTheme, setIsDarkTheme] = useState(getCurrentTheme()); + + useEffect(() => { + // On mount, set theme from localStorage if available + if (typeof window !== 'undefined') { + const stored = localStorage.getItem('theme'); + if (stored === 'dark') { + document.documentElement.setAttribute('data-theme', 'dark'); + setIsDarkTheme(true); + } else if (stored === 'light') { + document.documentElement.setAttribute('data-theme', 'light'); + setIsDarkTheme(false); + } + } + const handler = () => { + setIsDarkTheme(getCurrentTheme()); + }; + window.addEventListener('storage', handler); + // Listen for theme changes + const observer = new MutationObserver(handler); + observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] }); + return () => { + window.removeEventListener('storage', handler); + observer.disconnect(); + }; + }, []); + + const setLightTheme = () => { + document.documentElement.setAttribute('data-theme', 'light'); + localStorage.setItem('theme', 'light'); + setIsDarkTheme(false); + }; + const setDarkTheme = () => { + document.documentElement.setAttribute('data-theme', 'dark'); + localStorage.setItem('theme', 'dark'); + setIsDarkTheme(true); + }; + + return { + isDarkTheme, + setLightTheme, + setDarkTheme, + }; +} From be0ade848440d491a29e81ac9c9f8bd3505df5cc Mon Sep 17 00:00:00 2001 From: Soumyodeep-Das Date: Sat, 21 Jun 2025 01:06:55 +0530 Subject: [PATCH 3/4] modify: Navbar Revamped Signed-off-by: Soumyodeep-Das --- src/theme/Navbar/index.js | 291 +++++++++++++++++++++++++++++++++----- 1 file changed, 258 insertions(+), 33 deletions(-) diff --git a/src/theme/Navbar/index.js b/src/theme/Navbar/index.js index 64f906255..e5749581d 100644 --- a/src/theme/Navbar/index.js +++ b/src/theme/Navbar/index.js @@ -77,21 +77,21 @@ const navItems = [ }, { title: 'Community Stories', - image: 'https://keploy.io/_next/static/media/community.d62a63d8.svg', + image: 'https://keploy.io/images/heart.svg', href: 'https://www.g2.com/products/keploy/reviews', height: '160px', width: '200px', }, { title: 'Tutorials', - image: 'https://keploy.io/_next/static/media/tutorials.7666a675.svg', + image: 'https://keploy.io/images/book.svg', href: 'https://www.youtube.com/playlist?list=PLuImHQnqnB_b3MbF1_873XeMhXkaZPpwV', height: '160px', width: '200px', }, { title: 'Migration Guide', - image: 'https://keploy.io/_next/static/media/migration.8de1314d.svg', + image: 'https://keploy.io/images/user-manual.svg', href: 'https://keploy.io/blog/technology/migration-guide-from-restassured-to-keploy', height: '160px', width: '200px', @@ -125,14 +125,14 @@ const navItems = [ }, { title: 'Contact Us', - image: 'https://keploy.io/_next/static/media/contact.8d4fbcb2.svg', + image: 'https://keploy.io/_next/static/media/resource-1.500a7b0a.svg', href: 'https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ2l-psdTCNCLYAJ-Jt5ESyGP7gi1_U70ySTjtFNr0Kmx5UagNJnyzg7lNjA3NKnaP6qFfpAgcdZ', height: '140px', width: '180px', }, { title: 'Community Forum', - image: 'https://keploy.io/_next/static/media/community-forum.f92d4c5e.svg', + image: 'https://keploy.io/_next/static/media/resource-2.b09d3d88.svg', href: 'https://github.com/keploy', height: '140px', width: '180px', @@ -305,37 +305,262 @@ export default function Navbar() { )} ))} - - {/* Mega menu dropdown - with hover handling */} + + {/* Mega menu dropdown - custom layout for each menu */} {openMenu && navItems.find(item => item.label === openMenu)?.megaMenu && ( -
{ - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - } - }} +
{ if (timeoutRef.current) clearTimeout(timeoutRef.current); }} onMouseLeave={handleMouseLeave} + style={{ justifyContent: 'center' }} > -
- {navItems.find(item => item.label === openMenu).megaMenu.map((card) => ( - - {card.title} -
-
{card.title}
-
{card.description}
-
- - ))} -
+ {/* PRODUCTS: 2x2 grid, large left card, two stacked right cards */} + {openMenu === 'Products' && ( +
+ {/* Left Half */} +
+ + {navItems[0].megaMenu[0].title} +
+
+ {navItems[0].megaMenu[0].title} +
+
+ {navItems[0].megaMenu[0].description} +
+
+ +
+ + {/* Right Half */} +
+ {[1, 2].map((idx) => ( + + {navItems[0].megaMenu[idx].title} +
+
+ {navItems[0].megaMenu[idx].title} +
+
+ {navItems[0].megaMenu[idx].description} +
+
+ + ))} +
+
+ )} + + {/* SOLUTIONS: 3 cards in a row, each with a white background, orange border, rounded corners, shadow, and proper spacing */} + {openMenu === 'Solutions' && ( +
+
+ {navItems[1].megaMenu.map((card) => ( + + {/* Image as background layer */} + {card.title} + + {/* Overlay text container */} +
+
{card.title}
+ {card.description && ( +
{card.description}
+ )} +
+ + ))} +
+
+ + )} + {/* DEVELOPERS: 2 large cards left, 3 stacked right cards */} + {openMenu === 'Developers' && ( +
+ {/* Left Column (Large Cards) */} +
+ {[0, 1].map((idx) => ( + + {navItems[2].megaMenu[idx].title} +
+
+ {navItems[2].megaMenu[idx].title} +
+ {navItems[2].megaMenu[idx].description && ( +
+ {navItems[2].megaMenu[idx].description} +
+ )} +
+ + ))} +
+ + {/* Right Column (Horizontal Row Cards) */} +
+ {[2, 3, 4].map(idx => ( + + {navItems[2].megaMenu[idx].title} +
+
{navItems[2].megaMenu[idx].title}
+
{navItems[2].megaMenu[idx].description || ''}
+
+ + ))} +
+
+ )} + + {/* RESOURCES: 2x2 grid left, 2 stacked right cards */} + {openMenu === 'Resources' && ( +
+ {/* Left: 2x2 grid of image cards */} + {/* Left Column (cards 0 and 1) */} +
+ {[0, 1].map((idx) => { + const card = navItems[4].megaMenu[idx]; + if (!card) return null; + return ( + + {card.title} +
+
{card.title}
+ {card.description && ( +
{card.description}
+ )} +
+ + ); + })} +
+ + {/* Center Column (card 2) */} +
+ {[2].map((idx) => { + const card = navItems[4].megaMenu[idx]; + if (!card) return null; + return ( + + {card.title} +
+
{card.title}
+ {card.description && ( +
{card.description}
+ )} +
+ + ); + })} +
+ + {/* Right Column (cards 3 and 4, horizontal layout) */} +
+ {[3, 4].map((idx) => { + const card = navItems[4].megaMenu[idx]; + if (!card) return null; + + return ( + + {/* Background Image */} + {card.title} + + {/* Overlay */} +
+ {/* Optional: Icon version of image — if not needed, remove this */} + {/* */} + +
+
+ {card.title} +
+ {card.description && ( +
+ {card.description} +
+ )} +
+ + {/* Arrow icon */} + + + +
+ + ); + })} +
+ + +
+ )}
)}
From 2231006ca03f3fa784dadf6d4c5c681d7df17dd4 Mon Sep 17 00:00:00 2001 From: Soumyodeep-Das Date: Sat, 21 Jun 2025 02:02:20 +0530 Subject: [PATCH 4/4] fixed: getNavbarHeight error is fixed Signed-off-by: Soumyodeep-Das --- src/theme/Navbar/index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/theme/Navbar/index.js b/src/theme/Navbar/index.js index e5749581d..1c460d055 100644 --- a/src/theme/Navbar/index.js +++ b/src/theme/Navbar/index.js @@ -1,6 +1,7 @@ import React, { useState, useRef } from 'react'; import Link from '@docusaurus/Link'; import useThemeContext from '../hooks/useThemeContext'; +import Layout from '@theme/Layout'; const navItems = [ { @@ -261,6 +262,7 @@ function KeployLogo() { } export default function Navbar() { + const navbarRef = useRef(null); const [openMenu, setOpenMenu] = useState(null); const { isDarkTheme } = useThemeContext(); const timeoutRef = useRef(null); @@ -279,7 +281,12 @@ export default function Navbar() { }; return ( -