From 10d2c25a8519dc285ecafd4a13508b2ae5f755f0 Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Thu, 23 Apr 2026 17:28:22 +0530 Subject: [PATCH 01/18] docs: document Java dynamic dedup Signed-off-by: Asish Kumar --- .../keploy-cloud/deduplication.md | 101 ++++++++++++++++++ .../server/sdk-installation/java.md | 6 ++ 2 files changed, 107 insertions(+) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index 5d4ca44c2..f9aff473a 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -34,6 +34,107 @@ To detect duplicate tests, simply run the below command, like so: keploy test -c "docker compose up" --containerName containerName --dedup ``` +### For Java Applications + +**1. Pre-requisite** + +Add the Keploy Java SDK to your application: + +```xml + + io.keploy + keploy-sdk + N.N.N + +``` + +For Spring Boot applications, register the Keploy middleware in your main class: + +```java +import io.keploy.servlet.KeployMiddleware; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Import; + +@SpringBootApplication +@Import(KeployMiddleware.class) +public class App { +} +``` + +Java dynamic deduplication uses JaCoCo runtime coverage, so start the application with the JaCoCo agent in TCP server mode: + +```bash +java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver \ + -jar target/app.jar +``` + +The default JaCoCo endpoint is `127.0.0.1:36320`. You can override it with `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT`, or with the JVM properties `keploy.jacoco.host` and `keploy.jacoco.port`. + +**2. Build Configuration** + +Build the application before running Keploy so the Java class files are available for coverage analysis: + +```bash +mvn clean package -DskipTests +``` + +By default, the SDK scans `target/classes`, `build/classes/java/main`, and runtime classpath jars. For custom layouts or restricted Docker images, set `KEPLOY_JAVA_CLASS_DIRS` to the class directories or jars that should be analyzed. + +**3. Dockerfile Configuration (Important for Docker Users)** + +When you use Docker or Docker Compose, make sure the final runtime image contains: + +- the runnable application jar, +- the JaCoCo runtime agent jar, +- the compiled classes or the fat jar that contains the application classes. + +For example: + +```dockerfile +COPY target/app.jar /app/app.jar +COPY target/classes /app/target/classes +COPY jacocoagent.jar /app/jacocoagent.jar +``` + +Then run the app with JaCoCo enabled: + +```bash +java -javaagent:/app/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=/tmp/jacoco-keploy.exec,output=tcpserver \ + -jar /app/app.jar +``` + +Keploy shares its socket directory with the application during deduplication. If your Docker environment is restricted, keep `/tmp` writable and do not override the Keploy socket mount. + +**4. Run Deduplication** + +For Docker, run: + +```bash +keploy test -c "docker compose up" --containerName containerName --dedup +``` + +For Native, run: + +```bash +keploy test -c "java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" --dedup +``` + +This will generate a `dedupData.yaml` file. + +After this, run: + +```bash +keploy dedup +``` + +This command will create a `duplicates.yaml` file which will contain all the test cases which were found to be duplicate. + +In order to remove all the duplicate test cases, run the following command: + +```bash +keploy dedup --rm +``` + ### For Golang Applications **1. Pre-requisite** diff --git a/versioned_docs/version-4.0.0/server/sdk-installation/java.md b/versioned_docs/version-4.0.0/server/sdk-installation/java.md index 2cef4465f..4624318a0 100644 --- a/versioned_docs/version-4.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-4.0.0/server/sdk-installation/java.md @@ -23,6 +23,12 @@ import ProductTier from '@site/src/components/ProductTier'; +## Java SDK and Dynamic Deduplication + +The Java SDK also supports Enterprise dynamic deduplication during replay. Dynamic deduplication uses the Keploy Java SDK with JaCoCo TCP server mode to collect per-test coverage and generate `dedupData.yaml`. + +See [Remove Duplicate Tests](/docs/keploy-cloud/deduplication#for-java-applications) for the Java setup, Docker notes, and `keploy test --dedup` commands. + ## πŸ› οΈ Language Specific Requirements | Programming Language | Prerequisites | From 2270f5686c4c5f987d105caa640243d142b1d897 Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Thu, 23 Apr 2026 17:37:06 +0530 Subject: [PATCH 02/18] ci: scope Vale lint to changed docs Signed-off-by: Asish Kumar --- .github/workflows/vale-lint-action.yml | 17 +++++++++++++++-- vale_styles/config/vocabularies/Base/accept.txt | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vale-lint-action.yml b/.github/workflows/vale-lint-action.yml index 12e3a841e..994fe8c4b 100644 --- a/.github/workflows/vale-lint-action.yml +++ b/.github/workflows/vale-lint-action.yml @@ -8,9 +8,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + + - name: Collect changed docs + id: changed-docs + shell: bash + run: | + files=$(git diff --name-only --diff-filter=ACMRT "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" -- 'versioned_docs/**/*.md' | paste -sd, -) + echo "files=${files}" >> "$GITHUB_OUTPUT" # Set up Vale Action β€” only lint changed lines to avoid flagging pre-existing issues. - uses: errata-ai/vale-action@v2.1.1 + if: steps.changed-docs.outputs.files != '' with: # Only check lines added/modified in the PR diff. filter_mode: diff_context @@ -18,8 +28,11 @@ jobs: reporter: github-pr-check # Fails the action if there are errors fail_on_error: true - # Lint docs across all versioned directories - files: 'versioned_docs' + # Lint only changed versioned docs. The action fails on all Vale output + # before reviewdog filters annotations, so a broad directory here makes + # pre-existing docs issues fail unrelated PRs. + files: ${{ steps.changed-docs.outputs.files }} + separator: ',' # Specify the Vale version version: 3.0.3 env: diff --git a/vale_styles/config/vocabularies/Base/accept.txt b/vale_styles/config/vocabularies/Base/accept.txt index d6fd38645..9e09b8033 100644 --- a/vale_styles/config/vocabularies/Base/accept.txt +++ b/vale_styles/config/vocabularies/Base/accept.txt @@ -12,6 +12,7 @@ Cmd Cobertura config containerName +classpath custom_functions DBs declaratively @@ -36,6 +37,7 @@ Hoppscotch html HTTPProxy Idempotency +JaCoCo Jacoco JBehave JMeter @@ -71,6 +73,7 @@ Spotify status_code status_code_class status_code_in +subcommand substring templatize Testcase @@ -79,6 +82,7 @@ Testim testmode Testrun testsets +toolchain timeFreezing Traefik Twilio From 37e96d41cfeb048fc55861cacc1d3f9be8c95665 Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Thu, 23 Apr 2026 17:47:04 +0530 Subject: [PATCH 03/18] docs: mention JaCoCo pass-through for Java dedup Signed-off-by: Asish Kumar --- versioned_docs/version-4.0.0/keploy-cloud/deduplication.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index f9aff473a..ca38f2711 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -68,7 +68,7 @@ java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=363 -jar target/app.jar ``` -The default JaCoCo endpoint is `127.0.0.1:36320`. You can override it with `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT`, or with the JVM properties `keploy.jacoco.host` and `keploy.jacoco.port`. +The default JaCoCo endpoint is `127.0.0.1:36320`. You can override it with `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT`, or with the JVM properties `keploy.jacoco.host` and `keploy.jacoco.port`. Add the JaCoCo port to `--pass-through-ports` when running Keploy so coverage-control traffic is not recorded or mocked. **2. Build Configuration** @@ -110,13 +110,13 @@ Keploy shares its socket directory with the application during deduplication. If For Docker, run: ```bash -keploy test -c "docker compose up" --containerName containerName --dedup +keploy test -c "docker compose up" --containerName containerName --dedup --pass-through-ports 36320 ``` For Native, run: ```bash -keploy test -c "java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" --dedup +keploy test -c "java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" --dedup --pass-through-ports 36320 ``` This will generate a `dedupData.yaml` file. From a0d8a21514ea412eca19e7495f11f4b7a0565bc8 Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Thu, 23 Apr 2026 18:25:32 +0530 Subject: [PATCH 04/18] docs: document Java dedup Docker hardening Signed-off-by: Asish Kumar --- versioned_docs/version-4.0.0/keploy-cloud/deduplication.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index ca38f2711..531bde662 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -105,6 +105,8 @@ java -javaagent:/app/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=/tmp/ Keploy shares its socket directory with the application during deduplication. If your Docker environment is restricted, keep `/tmp` writable and do not override the Keploy socket mount. +For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and a writable `/tmp` mount for the Keploy control/data sockets and JaCoCo output. Keep `/tmp` writable with normal temporary-directory permissions, for example `mode=1777`, because the Java SDK uses Unix sockets under `/tmp`. + **4. Run Deduplication** For Docker, run: From b89b674bf8d9fe61880da0abb170e162eb24c75f Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Thu, 23 Apr 2026 18:46:03 +0530 Subject: [PATCH 05/18] docs: clarify Java dedup Docker socket volume Signed-off-by: Asish Kumar --- versioned_docs/version-4.0.0/keploy-cloud/deduplication.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index 531bde662..e6e8f7f3b 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -103,9 +103,9 @@ java -javaagent:/app/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=/tmp/ -jar /app/app.jar ``` -Keploy shares its socket directory with the application during deduplication. If your Docker environment is restricted, keep `/tmp` writable and do not override the Keploy socket mount. +Keploy shares its socket directory with the application during deduplication. If your Docker environment is restricted, keep `/tmp` writable and do not override the Keploy socket volume. -For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and a writable `/tmp` mount for the Keploy control/data sockets and JaCoCo output. Keep `/tmp` writable with normal temporary-directory permissions, for example `mode=1777`, because the Java SDK uses Unix sockets under `/tmp`. +For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and a writable shared `/tmp` volume for the Keploy control/data sockets and JaCoCo output. The Java SDK uses Unix sockets under `/tmp`, so do not replace the shared socket volume with a separate container-only `tmpfs`. **4. Run Deduplication** From e6feee6c032dafb4d36b5a578ce9fd1e2828415f Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Thu, 23 Apr 2026 19:16:40 +0530 Subject: [PATCH 06/18] docs: clarify Java dedup Docker bind mount Signed-off-by: Asish Kumar --- versioned_docs/version-4.0.0/keploy-cloud/deduplication.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index e6e8f7f3b..0c154ae4b 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -103,9 +103,9 @@ java -javaagent:/app/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=/tmp/ -jar /app/app.jar ``` -Keploy shares its socket directory with the application during deduplication. If your Docker environment is restricted, keep `/tmp` writable and do not override the Keploy socket volume. +Keploy and the Java SDK exchange per-test coverage signals over `/tmp/coverage_control.sock` and `/tmp/coverage_data.sock`. For Docker and Docker Compose, bind-mount host `/tmp` into the application container so both processes see the same socket paths. -For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and a writable shared `/tmp` volume for the Keploy control/data sockets and JaCoCo output. The Java SDK uses Unix sockets under `/tmp`, so do not replace the shared socket volume with a separate container-only `tmpfs`. +For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and host `/tmp` bind-mounted into the container for the Keploy control/data sockets and JaCoCo output. Do not replace the shared `/tmp` bind mount with a container-only `tmpfs` or named volume; Keploy on the host will not be able to reach the Java SDK control socket. **4. Run Deduplication** From 5cdd50052c5abc694ae2e9682c8654a0f435b157 Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Fri, 24 Apr 2026 13:11:34 +0530 Subject: [PATCH 07/18] docs: document Java dedup-only SDK Signed-off-by: Asish Kumar --- .../server/sdk-installation/java.md | 179 ++++++++--------- .../server/sdk-installation/java.md | 188 ++++++++--------- .../server/sdk-installation/java.md | 189 ++++++++---------- 3 files changed, 247 insertions(+), 309 deletions(-) diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/java.md b/versioned_docs/version-2.0.0/server/sdk-installation/java.md index 97a6070c6..204765f5b 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/java.md @@ -1,120 +1,113 @@ --- id: java -title: Merge Unit Test Coverage Data +title: Java SDK for Dynamic Deduplication sidebar_label: Java +description: "Configure the Keploy Java SDK for Enterprise dynamic deduplication with JaCoCo TCP server mode." tags: - java - coverage + - deduplication keywords: - - MongoDB - - Jacoco - - Maven - - Springboot Framework - - Postgres - - SQL - Java - - API Test generator - - Auto Testcase generation - - Junit + - JaCoCo + - Maven + - Spring Boot + - dynamic deduplication --- -import WhatAreKeployFeatures from './index.md' +The Java SDK is used for Enterprise dynamic deduplication during replay/test mode. It collects per-testcase Java coverage and sends it to Keploy Enterprise so duplicate testcases can be identified. + +The Java SDK does not record API traffic or mock dependencies. Record your Keploy tests separately, commit the generated test fixtures when you use them in CI, and run Java dedup during `keploy test --dedup`. + +## Requirements + +- Java 8, 17, or 21 +- `io.keploy:keploy-sdk` +- JaCoCo runtime agent in TCP server mode +- Keploy Enterprise with dynamic deduplication enabled + +## Add the SDK + +Add the Keploy Java SDK dependency: + +```xml + + io.keploy + keploy-sdk + N.N.N + +``` + +## Start the Dedup Agent + +For Spring Boot 2 or other `javax.servlet` applications, import the middleware: + +```java +import io.keploy.servlet.KeployMiddleware; +import org.springframework.context.annotation.Import; + +@Import(KeployMiddleware.class) +public class Application { +} +``` + +For Jakarta Servlet, Spring Boot 3, non-servlet frameworks, or custom launchers, start the agent during application startup: - +```java +import io.keploy.dedup.KeployDedupAgent; -## πŸ› οΈ Language Specific Requirements +KeployDedupAgent.start(); +``` -| Programming Language | Prerequisites | -| :------------------: | :------------- | -| java | [Jacoco 0.8.8] | +## Run with JaCoCo TCP Server Mode -**Note**: In case of java application, before running test subcommand, you need to clean the project by removing any previously generated file, and run install command. +Run the Java application with the JaCoCo runtime agent in `tcpserver` mode. Keploy uses the JaCoCo TCP port to reset and dump per-testcase coverage during replay. ```bash -mvn clean install -Dmaven.test.skip=true +java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver \ + -jar target/app.jar ``` -## Usage +If your compiled application classes are not under `target/classes` or `build/classes/java/main`, set `KEPLOY_JAVA_CLASS_DIRS`: -### Update `pom.xml` file +```bash +export KEPLOY_JAVA_CLASS_DIRS=/absolute/path/to/target/classes +``` -You will need to add the following plugins in `pom.xml` file of your application. :- +## Replay with Dedup -```xml - - - - - org.jacoco - jacoco-maven-plugin - 0.8.8 - - - - prepare-agent - - prepare-agent - - - - - merge-ut-e2e - test - - merge - - - - - ${project.build.directory} - - jacoco.exec - keploy-e2e.exec - - - - - ${project.build.directory}/ut-e2e-merged.exec - - - - - - post-unit-test - test - - report - - - ${project.build.directory}/jacoco.exec - - ${project.reporting.outputDirectory}/ut - - - - - combined-ut-e2e - test - - report - - - ${project.build.directory}/ut-e2e-merged.exec - - ${project.reporting.outputDirectory}/e2e-ut-aggregate - - - - - - - +Run Keploy in test mode with dynamic deduplication enabled and pass through the JaCoCo TCP port: + +```bash +keploy test \ + -c "java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" \ + --dedup \ + --pass-through-ports 36320 +``` + +After replay, run: + +```bash +keploy dedup ``` -Now, To get the combined report as well as coverage report for your unit tests, Run +To remove duplicate testcases: ```bash -mvn test +keploy dedup --rm ``` -The html file for unit tests report would be generated in target/site/ut directory and, for combined report it would be generated in target/site/e2e-ut-aggregate directory. Open index.html to visualize the report. +## Docker and Restricted Docker + +Java dedup uses two Unix sockets shared between Keploy Enterprise and the Java process: + +- `/tmp/coverage_control.sock` +- `/tmp/coverage_data.sock` + +For Docker or Docker Compose runs, bind-mount host `/tmp` into the application container as `/tmp` so both processes use the same socket paths. Keep `/tmp` writable even when the root filesystem is read-only. + +For restricted containers, the application can run as a non-root user with dropped capabilities and `no-new-privileges` as long as `/tmp` is shared and writable, and the JaCoCo TCP port is reachable from the Java process. + +## CI Guidance + +CI should run replay/test mode against checked-in Keploy test fixtures. Do not record Java dedup fixtures in the pipeline unless you intentionally want to refresh them. diff --git a/versioned_docs/version-3.0.0/server/sdk-installation/java.md b/versioned_docs/version-3.0.0/server/sdk-installation/java.md index 2f61b982b..3fa81e30f 100644 --- a/versioned_docs/version-3.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-3.0.0/server/sdk-installation/java.md @@ -1,141 +1,117 @@ --- id: java -title: Merge Unit and Keploy Test Coverage Data +title: Java SDK for Dynamic Deduplication sidebar_label: Java +description: "Configure the Keploy Java SDK for Enterprise dynamic deduplication with JaCoCo TCP server mode." tags: - java - coverage + - deduplication keywords: - - MongoDB - - Jacoco - - Maven - - Springboot Framework - - Postgres - - SQL - Java - - API Test generator - - Auto Testcase generation - - Junit + - JaCoCo + - Maven + - Spring Boot + - dynamic deduplication --- import ProductTier from '@site/src/components/ProductTier'; - + -## πŸ› οΈ Language Specific Requirements +The Java SDK is used for Enterprise dynamic deduplication during replay/test mode. It collects per-testcase Java coverage and sends it to Keploy Enterprise so duplicate testcases can be identified. -| Programming Language | Prerequisites | -| :------------------: | :------------- | -| java | [Jacoco 0.8.8] | +The Java SDK does not record API traffic or mock dependencies. Record your Keploy tests separately, commit the generated test fixtures when you use them in CI, and run Java dedup during `keploy test --dedup`. -**Note**: In case of java application, before running test subcommand, you need to clean the project by removing any previously generated file, and run install command. +## Requirements -```bash -mvn clean install -Dmaven.test.skip=true +- Java 8, 17, or 21 +- `io.keploy:keploy-sdk` +- JaCoCo runtime agent in TCP server mode +- Keploy Enterprise with dynamic deduplication enabled + +## Add the SDK + +Add the Keploy Java SDK dependency: + +```xml + + io.keploy + keploy-sdk + N.N.N + ``` -## Usage +## Start the Dedup Agent -### Update `pom.xml` file +For Spring Boot 2 or other `javax.servlet` applications, import the middleware: -You will need to add the following plugins in `pom.xml` file of your application. :- +```java +import io.keploy.servlet.KeployMiddleware; +import org.springframework.context.annotation.Import; -```xml - - - - - org.jacoco - jacoco-maven-plugin - 0.8.8 - - - - prepare-agent - - prepare-agent - - - - - merge-ut-e2e - test - - merge - - - - - ${project.build.directory} - - jacoco.exec - keploy-e2e.exec - - - - - ${project.build.directory}/ut-e2e-merged.exec - - - - - - post-unit-test - test - - report - - - ${project.build.directory}/jacoco.exec - - ${project.reporting.outputDirectory}/ut - - - - - combined-ut-e2e - test - - report - - - ${project.build.directory}/ut-e2e-merged.exec - - ${project.reporting.outputDirectory}/e2e-ut-aggregate - - - - - - - +@Import(KeployMiddleware.class) +public class Application { +} ``` -Once it has been done, run keploy test command: +For Jakarta Servlet, Spring Boot 3, non-servlet frameworks, or custom launchers, start the agent during application startup: + +```java +import io.keploy.dedup.KeployDedupAgent; + +KeployDedupAgent.start(); +``` +## Run with JaCoCo TCP Server Mode + +Run the Java application with the JaCoCo runtime agent in `tcpserver` mode. Keploy uses the JaCoCo TCP port to reset and dump per-testcase coverage during replay. + +```bash +java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver \ + -jar target/app.jar ``` -keploy test -c "your_application_command" + +If your compiled application classes are not under `target/classes` or `build/classes/java/main`, set `KEPLOY_JAVA_CLASS_DIRS`: + +```bash +export KEPLOY_JAVA_CLASS_DIRS=/absolute/path/to/target/classes ``` -After successful execution of this command, A coverage report would be generated inside the test-run folder of keploy/reports. +## Replay with Dedup + +Run Keploy in test mode with dynamic deduplication enabled and pass through the JaCoCo TCP port: +```bash +keploy test \ + -c "java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" \ + --dedup \ + --pass-through-ports 36320 ``` -keploy -β”œβ”€β”€ reports -β”‚ └── test-run-0 -β”‚ β”œβ”€β”€ coverage.yaml -β”‚ └── test-set-0-report.yaml -└── test-set-0 - β”œβ”€β”€ mocks.yaml - └── tests - β”œβ”€β”€ test-1.yaml - └── test-2.yaml + +After replay, run: + +```bash +keploy dedup ``` -Now, To get the combined report as well as coverage report for your unit tests, Run +To remove duplicate testcases: ```bash -mvn test +keploy dedup --rm ``` -The html file for unit tests report would be generated in target/site/ut directory and, for combined report it would be generated in target/site/e2e-ut-aggregate directory. Open index.html to visualize the report. +## Docker and Restricted Docker + +Java dedup uses two Unix sockets shared between Keploy Enterprise and the Java process: + +- `/tmp/coverage_control.sock` +- `/tmp/coverage_data.sock` + +For Docker or Docker Compose runs, bind-mount host `/tmp` into the application container as `/tmp` so both processes use the same socket paths. Keep `/tmp` writable even when the root filesystem is read-only. + +For restricted containers, the application can run as a non-root user with dropped capabilities and `no-new-privileges` as long as `/tmp` is shared and writable, and the JaCoCo TCP port is reachable from the Java process. + +## CI Guidance + +CI should run replay/test mode against checked-in Keploy test fixtures. Do not record Java dedup fixtures in the pipeline unless you intentionally want to refresh them. diff --git a/versioned_docs/version-4.0.0/server/sdk-installation/java.md b/versioned_docs/version-4.0.0/server/sdk-installation/java.md index 4624318a0..3fa81e30f 100644 --- a/versioned_docs/version-4.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-4.0.0/server/sdk-installation/java.md @@ -1,148 +1,117 @@ --- id: java -title: Merge Test Coverage Data β€” Java +title: Java SDK for Dynamic Deduplication sidebar_label: Java -description: "Merge Keploy and Java unit test coverage using JaCoCo β€” combine integration and unit test reports for full visibility." +description: "Configure the Keploy Java SDK for Enterprise dynamic deduplication with JaCoCo TCP server mode." tags: - java - coverage + - deduplication keywords: - - MongoDB - - Jacoco - - Maven - - Springboot Framework - - Postgres - - SQL - Java - - API Test generator - - Auto Testcase generation - - Junit + - JaCoCo + - Maven + - Spring Boot + - dynamic deduplication --- import ProductTier from '@site/src/components/ProductTier'; - + -## Java SDK and Dynamic Deduplication +The Java SDK is used for Enterprise dynamic deduplication during replay/test mode. It collects per-testcase Java coverage and sends it to Keploy Enterprise so duplicate testcases can be identified. -The Java SDK also supports Enterprise dynamic deduplication during replay. Dynamic deduplication uses the Keploy Java SDK with JaCoCo TCP server mode to collect per-test coverage and generate `dedupData.yaml`. +The Java SDK does not record API traffic or mock dependencies. Record your Keploy tests separately, commit the generated test fixtures when you use them in CI, and run Java dedup during `keploy test --dedup`. -See [Remove Duplicate Tests](/docs/keploy-cloud/deduplication#for-java-applications) for the Java setup, Docker notes, and `keploy test --dedup` commands. +## Requirements -## πŸ› οΈ Language Specific Requirements +- Java 8, 17, or 21 +- `io.keploy:keploy-sdk` +- JaCoCo runtime agent in TCP server mode +- Keploy Enterprise with dynamic deduplication enabled -| Programming Language | Prerequisites | -| :------------------: | :------------- | -| java | [Jacoco 0.8.8] | +## Add the SDK -**Note**: In case of java application, before running test subcommand, you need to clean the project by removing any previously generated file, and run install command. +Add the Keploy Java SDK dependency: -```bash -mvn clean install -Dmaven.test.skip=true +```xml + + io.keploy + keploy-sdk + N.N.N + ``` -## Usage +## Start the Dedup Agent -### Update `pom.xml` file +For Spring Boot 2 or other `javax.servlet` applications, import the middleware: -You will need to add the following plugins in `pom.xml` file of your application. :- +```java +import io.keploy.servlet.KeployMiddleware; +import org.springframework.context.annotation.Import; -```xml - - - - - org.jacoco - jacoco-maven-plugin - 0.8.8 - - - - prepare-agent - - prepare-agent - - - - - merge-ut-e2e - test - - merge - - - - - ${project.build.directory} - - jacoco.exec - keploy-e2e.exec - - - - - ${project.build.directory}/ut-e2e-merged.exec - - - - - - post-unit-test - test - - report - - - ${project.build.directory}/jacoco.exec - - ${project.reporting.outputDirectory}/ut - - - - - combined-ut-e2e - test - - report - - - ${project.build.directory}/ut-e2e-merged.exec - - ${project.reporting.outputDirectory}/e2e-ut-aggregate - - - - - - - +@Import(KeployMiddleware.class) +public class Application { +} ``` -Once it has been done, run keploy test command: +For Jakarta Servlet, Spring Boot 3, non-servlet frameworks, or custom launchers, start the agent during application startup: + +```java +import io.keploy.dedup.KeployDedupAgent; +KeployDedupAgent.start(); ``` -keploy test -c "your_application_command" + +## Run with JaCoCo TCP Server Mode + +Run the Java application with the JaCoCo runtime agent in `tcpserver` mode. Keploy uses the JaCoCo TCP port to reset and dump per-testcase coverage during replay. + +```bash +java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver \ + -jar target/app.jar ``` -After successful execution of this command, A coverage report would be generated inside the test-run folder of keploy/reports. +If your compiled application classes are not under `target/classes` or `build/classes/java/main`, set `KEPLOY_JAVA_CLASS_DIRS`: +```bash +export KEPLOY_JAVA_CLASS_DIRS=/absolute/path/to/target/classes ``` -keploy -β”œβ”€β”€ reports -β”‚ └── test-run-0 -β”‚ β”œβ”€β”€ coverage.yaml -β”‚ └── test-set-0-report.yaml -└── test-set-0 - β”œβ”€β”€ mocks.yaml - └── tests - β”œβ”€β”€ test-1.yaml - └── test-2.yaml + +## Replay with Dedup + +Run Keploy in test mode with dynamic deduplication enabled and pass through the JaCoCo TCP port: + +```bash +keploy test \ + -c "java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" \ + --dedup \ + --pass-through-ports 36320 +``` + +After replay, run: + +```bash +keploy dedup ``` -Now, To get the combined report as well as coverage report for your unit tests, Run +To remove duplicate testcases: ```bash -mvn test +keploy dedup --rm ``` -The html file for unit tests report would be generated in target/site/ut directory and, for combined report it would be generated in target/site/e2e-ut-aggregate directory. Open index.html to visualize the report. +## Docker and Restricted Docker + +Java dedup uses two Unix sockets shared between Keploy Enterprise and the Java process: + +- `/tmp/coverage_control.sock` +- `/tmp/coverage_data.sock` + +For Docker or Docker Compose runs, bind-mount host `/tmp` into the application container as `/tmp` so both processes use the same socket paths. Keep `/tmp` writable even when the root filesystem is read-only. + +For restricted containers, the application can run as a non-root user with dropped capabilities and `no-new-privileges` as long as `/tmp` is shared and writable, and the JaCoCo TCP port is reachable from the Java process. + +## CI Guidance + +CI should run replay/test mode against checked-in Keploy test fixtures. Do not record Java dedup fixtures in the pipeline unless you intentionally want to refresh them. From 0fb64ae0f83389d68cfe97f61025adcd7c50862d Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Fri, 24 Apr 2026 13:14:37 +0530 Subject: [PATCH 08/18] docs: fix Java dedup wording Signed-off-by: Asish Kumar --- versioned_docs/version-2.0.0/server/sdk-installation/java.md | 2 +- versioned_docs/version-3.0.0/server/sdk-installation/java.md | 2 +- versioned_docs/version-4.0.0/server/sdk-installation/java.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/java.md b/versioned_docs/version-2.0.0/server/sdk-installation/java.md index 204765f5b..61de2289b 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/java.md @@ -51,7 +51,7 @@ public class Application { } ``` -For Jakarta Servlet, Spring Boot 3, non-servlet frameworks, or custom launchers, start the agent during application startup: +For Jakarta Servlet, Spring Boot 3, frameworks without the Servlet API, or custom launchers, start the agent during application startup: ```java import io.keploy.dedup.KeployDedupAgent; diff --git a/versioned_docs/version-3.0.0/server/sdk-installation/java.md b/versioned_docs/version-3.0.0/server/sdk-installation/java.md index 3fa81e30f..1632b8005 100644 --- a/versioned_docs/version-3.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-3.0.0/server/sdk-installation/java.md @@ -55,7 +55,7 @@ public class Application { } ``` -For Jakarta Servlet, Spring Boot 3, non-servlet frameworks, or custom launchers, start the agent during application startup: +For Jakarta Servlet, Spring Boot 3, frameworks without the Servlet API, or custom launchers, start the agent during application startup: ```java import io.keploy.dedup.KeployDedupAgent; diff --git a/versioned_docs/version-4.0.0/server/sdk-installation/java.md b/versioned_docs/version-4.0.0/server/sdk-installation/java.md index 3fa81e30f..1632b8005 100644 --- a/versioned_docs/version-4.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-4.0.0/server/sdk-installation/java.md @@ -55,7 +55,7 @@ public class Application { } ``` -For Jakarta Servlet, Spring Boot 3, non-servlet frameworks, or custom launchers, start the agent during application startup: +For Jakarta Servlet, Spring Boot 3, frameworks without the Servlet API, or custom launchers, start the agent during application startup: ```java import io.keploy.dedup.KeployDedupAgent; From 4d01541a726a380710af6f8d57156ea1dffb8f38 Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Fri, 24 Apr 2026 13:17:19 +0530 Subject: [PATCH 09/18] docs: avoid Vale Servlet warning Signed-off-by: Asish Kumar --- versioned_docs/version-2.0.0/server/sdk-installation/java.md | 2 +- versioned_docs/version-3.0.0/server/sdk-installation/java.md | 2 +- versioned_docs/version-4.0.0/server/sdk-installation/java.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/java.md b/versioned_docs/version-2.0.0/server/sdk-installation/java.md index 61de2289b..33178aed3 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/java.md @@ -51,7 +51,7 @@ public class Application { } ``` -For Jakarta Servlet, Spring Boot 3, frameworks without the Servlet API, or custom launchers, start the agent during application startup: +For Spring Boot 3, Jakarta EE applications, other frameworks, or custom launchers, start the agent during application startup: ```java import io.keploy.dedup.KeployDedupAgent; diff --git a/versioned_docs/version-3.0.0/server/sdk-installation/java.md b/versioned_docs/version-3.0.0/server/sdk-installation/java.md index 1632b8005..ffe0b6a9c 100644 --- a/versioned_docs/version-3.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-3.0.0/server/sdk-installation/java.md @@ -55,7 +55,7 @@ public class Application { } ``` -For Jakarta Servlet, Spring Boot 3, frameworks without the Servlet API, or custom launchers, start the agent during application startup: +For Spring Boot 3, Jakarta EE applications, other frameworks, or custom launchers, start the agent during application startup: ```java import io.keploy.dedup.KeployDedupAgent; diff --git a/versioned_docs/version-4.0.0/server/sdk-installation/java.md b/versioned_docs/version-4.0.0/server/sdk-installation/java.md index 1632b8005..ffe0b6a9c 100644 --- a/versioned_docs/version-4.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-4.0.0/server/sdk-installation/java.md @@ -55,7 +55,7 @@ public class Application { } ``` -For Jakarta Servlet, Spring Boot 3, frameworks without the Servlet API, or custom launchers, start the agent during application startup: +For Spring Boot 3, Jakarta EE applications, other frameworks, or custom launchers, start the agent during application startup: ```java import io.keploy.dedup.KeployDedupAgent; From 3579d9d17a4525a7bdb72ed06e2674d4500b9c5d Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Sat, 25 Apr 2026 19:44:16 +0530 Subject: [PATCH 10/18] docs(java-dedup): drop JaCoCo TCP server requirement - Update Java dedup install and deduplication pages across versions 2.0.0, 3.0.0, and 4.0.0 to reflect the in-process JaCoCo API as the default coverage transport. - Remove the requirement to launch JaCoCo in tcpserver mode and to pass --pass-through-ports for the JaCoCo port. - Document the TCP server fallback for environments where the runtime API is unavailable, including KEPLOY_JACOCO_HOST and KEPLOY_JACOCO_PORT. Signed-off-by: Asish Kumar --- .../server/sdk-installation/java.md | 22 ++++++++++++------ .../server/sdk-installation/java.md | 22 ++++++++++++------ .../keploy-cloud/deduplication.md | 23 ++++++++++++------- .../server/sdk-installation/java.md | 22 ++++++++++++------ 4 files changed, 60 insertions(+), 29 deletions(-) diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/java.md b/versioned_docs/version-2.0.0/server/sdk-installation/java.md index 33178aed3..94cfc7b81 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/java.md @@ -59,13 +59,12 @@ import io.keploy.dedup.KeployDedupAgent; KeployDedupAgent.start(); ``` -## Run with JaCoCo TCP Server Mode +## Run with the JaCoCo Java Agent -Run the Java application with the JaCoCo runtime agent in `tcpserver` mode. Keploy uses the JaCoCo TCP port to reset and dump per-testcase coverage during replay. +The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo agent is enough β€” no TCP server flags, no port choice: ```bash -java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver \ - -jar target/app.jar +java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar ``` If your compiled application classes are not under `target/classes` or `build/classes/java/main`, set `KEPLOY_JAVA_CLASS_DIRS`: @@ -74,17 +73,26 @@ If your compiled application classes are not under `target/classes` or `build/cl export KEPLOY_JAVA_CLASS_DIRS=/absolute/path/to/target/classes ``` +If the in-process API is unavailable in your environment, the SDK transparently falls back to JaCoCo's TCP server mode. To use the fallback explicitly, launch JaCoCo in `tcpserver` mode and configure `KEPLOY_JACOCO_HOST` / `KEPLOY_JACOCO_PORT` (defaults: `127.0.0.1:36320`): + +```bash +java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,output=tcpserver \ + -jar target/app.jar +``` + ## Replay with Dedup -Run Keploy in test mode with dynamic deduplication enabled and pass through the JaCoCo TCP port: +Run Keploy in test mode with dynamic deduplication enabled: ```bash keploy test \ - -c "java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" \ + -c "java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar" \ --dedup \ - --pass-through-ports 36320 + --language java ``` +If you are using the JaCoCo TCP fallback, also pass `--pass-through-ports ` so Keploy does not try to mock the coverage-control connection. + After replay, run: ```bash diff --git a/versioned_docs/version-3.0.0/server/sdk-installation/java.md b/versioned_docs/version-3.0.0/server/sdk-installation/java.md index ffe0b6a9c..97a519271 100644 --- a/versioned_docs/version-3.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-3.0.0/server/sdk-installation/java.md @@ -63,13 +63,12 @@ import io.keploy.dedup.KeployDedupAgent; KeployDedupAgent.start(); ``` -## Run with JaCoCo TCP Server Mode +## Run with the JaCoCo Java Agent -Run the Java application with the JaCoCo runtime agent in `tcpserver` mode. Keploy uses the JaCoCo TCP port to reset and dump per-testcase coverage during replay. +The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo agent is enough β€” no TCP server flags, no port choice: ```bash -java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver \ - -jar target/app.jar +java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar ``` If your compiled application classes are not under `target/classes` or `build/classes/java/main`, set `KEPLOY_JAVA_CLASS_DIRS`: @@ -78,17 +77,26 @@ If your compiled application classes are not under `target/classes` or `build/cl export KEPLOY_JAVA_CLASS_DIRS=/absolute/path/to/target/classes ``` +If the in-process API is unavailable in your environment, the SDK transparently falls back to JaCoCo's TCP server mode. To use the fallback explicitly, launch JaCoCo in `tcpserver` mode and configure `KEPLOY_JACOCO_HOST` / `KEPLOY_JACOCO_PORT` (defaults: `127.0.0.1:36320`): + +```bash +java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,output=tcpserver \ + -jar target/app.jar +``` + ## Replay with Dedup -Run Keploy in test mode with dynamic deduplication enabled and pass through the JaCoCo TCP port: +Run Keploy in test mode with dynamic deduplication enabled: ```bash keploy test \ - -c "java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" \ + -c "java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar" \ --dedup \ - --pass-through-ports 36320 + --language java ``` +If you are using the JaCoCo TCP fallback, also pass `--pass-through-ports ` so Keploy does not try to mock the coverage-control connection. + After replay, run: ```bash diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index 0c154ae4b..fce4bfe59 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -61,14 +61,20 @@ public class App { } ``` -Java dynamic deduplication uses JaCoCo runtime coverage, so start the application with the JaCoCo agent in TCP server mode: +Java dynamic deduplication uses JaCoCo runtime coverage. The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo Java agent is enough β€” no TCP server flags, no `--pass-through-ports`: ```bash -java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver \ +java -javaagent:/path/to/org.jacoco.agent-runtime.jar -jar target/app.jar +``` + +If the in-process API is unavailable for some reason (for example, an isolated classloader), the SDK transparently falls back to JaCoCo's TCP server mode. To force the fallback, launch JaCoCo in `tcpserver` mode and tell Keploy to leave that port alone: + +```bash +java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=36320,output=tcpserver \ -jar target/app.jar ``` -The default JaCoCo endpoint is `127.0.0.1:36320`. You can override it with `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT`, or with the JVM properties `keploy.jacoco.host` and `keploy.jacoco.port`. Add the JaCoCo port to `--pass-through-ports` when running Keploy so coverage-control traffic is not recorded or mocked. +The default JaCoCo endpoint for the fallback is `127.0.0.1:36320`. You can override it with `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT`, or with the JVM properties `keploy.jacoco.host` and `keploy.jacoco.port`. When using the fallback, add the JaCoCo port to `--pass-through-ports` so coverage-control traffic is not mocked. **2. Build Configuration** @@ -96,11 +102,10 @@ COPY target/classes /app/target/classes COPY jacocoagent.jar /app/jacocoagent.jar ``` -Then run the app with JaCoCo enabled: +Then run the app with the JaCoCo agent attached: ```bash -java -javaagent:/app/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=/tmp/jacoco-keploy.exec,output=tcpserver \ - -jar /app/app.jar +java -javaagent:/app/jacocoagent.jar -jar /app/app.jar ``` Keploy and the Java SDK exchange per-test coverage signals over `/tmp/coverage_control.sock` and `/tmp/coverage_data.sock`. For Docker and Docker Compose, bind-mount host `/tmp` into the application container so both processes see the same socket paths. @@ -112,15 +117,17 @@ For hardened Docker runs, the Java dedup sample is validated with a non-root run For Docker, run: ```bash -keploy test -c "docker compose up" --containerName containerName --dedup --pass-through-ports 36320 +keploy test -c "docker compose up" --containerName containerName --dedup --language java ``` For Native, run: ```bash -keploy test -c "java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" --dedup --pass-through-ports 36320 +keploy test -c "java -javaagent:/path/to/org.jacoco.agent-runtime.jar -jar target/app.jar" --dedup --language java ``` +If the SDK falls back to the JaCoCo TCP server, also pass `--pass-through-ports ` so Keploy does not try to mock the coverage-control connection. + This will generate a `dedupData.yaml` file. After this, run: diff --git a/versioned_docs/version-4.0.0/server/sdk-installation/java.md b/versioned_docs/version-4.0.0/server/sdk-installation/java.md index ffe0b6a9c..97a519271 100644 --- a/versioned_docs/version-4.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-4.0.0/server/sdk-installation/java.md @@ -63,13 +63,12 @@ import io.keploy.dedup.KeployDedupAgent; KeployDedupAgent.start(); ``` -## Run with JaCoCo TCP Server Mode +## Run with the JaCoCo Java Agent -Run the Java application with the JaCoCo runtime agent in `tcpserver` mode. Keploy uses the JaCoCo TCP port to reset and dump per-testcase coverage during replay. +The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo agent is enough β€” no TCP server flags, no port choice: ```bash -java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver \ - -jar target/app.jar +java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar ``` If your compiled application classes are not under `target/classes` or `build/classes/java/main`, set `KEPLOY_JAVA_CLASS_DIRS`: @@ -78,17 +77,26 @@ If your compiled application classes are not under `target/classes` or `build/cl export KEPLOY_JAVA_CLASS_DIRS=/absolute/path/to/target/classes ``` +If the in-process API is unavailable in your environment, the SDK transparently falls back to JaCoCo's TCP server mode. To use the fallback explicitly, launch JaCoCo in `tcpserver` mode and configure `KEPLOY_JACOCO_HOST` / `KEPLOY_JACOCO_PORT` (defaults: `127.0.0.1:36320`): + +```bash +java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,output=tcpserver \ + -jar target/app.jar +``` + ## Replay with Dedup -Run Keploy in test mode with dynamic deduplication enabled and pass through the JaCoCo TCP port: +Run Keploy in test mode with dynamic deduplication enabled: ```bash keploy test \ - -c "java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,destfile=target/jacoco-keploy.exec,output=tcpserver -jar target/app.jar" \ + -c "java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar" \ --dedup \ - --pass-through-ports 36320 + --language java ``` +If you are using the JaCoCo TCP fallback, also pass `--pass-through-ports ` so Keploy does not try to mock the coverage-control connection. + After replay, run: ```bash From 78b3fec5bddeca60803d2d867389aa29ebcaf34c Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Sun, 26 Apr 2026 13:46:22 +0530 Subject: [PATCH 11/18] docs(java): pin keploy-sdk dependency version to 2.0.0 - Replaces the N.N.N placeholders (and the leftover 0.0.1-SNAPSHOT in version-2.0.0/keploy-cloud/deduplication.md) across the v2/v3/v4 Java SDK install pages with the 2.0.0 release version. - End users on every documented Keploy version now see a copy-pasteable dependency block aligned with the first dedup-only Java SDK release. Signed-off-by: Asish Kumar --- versioned_docs/version-2.0.0/keploy-cloud/deduplication.md | 2 +- versioned_docs/version-2.0.0/server/sdk-installation/java.md | 2 +- versioned_docs/version-3.0.0/server/sdk-installation/java.md | 2 +- versioned_docs/version-4.0.0/keploy-cloud/deduplication.md | 2 +- versioned_docs/version-4.0.0/server/sdk-installation/java.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/versioned_docs/version-2.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-2.0.0/keploy-cloud/deduplication.md index 0b1d00e2d..ebf2c2c63 100644 --- a/versioned_docs/version-2.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-2.0.0/keploy-cloud/deduplication.md @@ -78,7 +78,7 @@ Put the latest keploy-sdk in your pom.xml file : - io.keploy keploy-sdk - 0.0.1-SNAPSHOT + 2.0.0 ``` diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/java.md b/versioned_docs/version-2.0.0/server/sdk-installation/java.md index 94cfc7b81..b39378453 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/java.md @@ -34,7 +34,7 @@ Add the Keploy Java SDK dependency: io.keploy keploy-sdk - N.N.N + 2.0.0 ``` diff --git a/versioned_docs/version-3.0.0/server/sdk-installation/java.md b/versioned_docs/version-3.0.0/server/sdk-installation/java.md index 97a519271..a663441b5 100644 --- a/versioned_docs/version-3.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-3.0.0/server/sdk-installation/java.md @@ -38,7 +38,7 @@ Add the Keploy Java SDK dependency: io.keploy keploy-sdk - N.N.N + 2.0.0 ``` diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index fce4bfe59..1cb511de1 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -44,7 +44,7 @@ Add the Keploy Java SDK to your application: io.keploy keploy-sdk - N.N.N + 2.0.0 ``` diff --git a/versioned_docs/version-4.0.0/server/sdk-installation/java.md b/versioned_docs/version-4.0.0/server/sdk-installation/java.md index 97a519271..a663441b5 100644 --- a/versioned_docs/version-4.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-4.0.0/server/sdk-installation/java.md @@ -38,7 +38,7 @@ Add the Keploy Java SDK dependency: io.keploy keploy-sdk - N.N.N + 2.0.0 ``` From 95f52bcad23f4cd786b9b571a3cee59c70a382a6 Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Sun, 26 Apr 2026 16:39:04 +0530 Subject: [PATCH 12/18] docs(java-dedup): scope Java dynamic dedup changes to v4 only - Revert versioned_docs/version-2.0.0 deduplication.md and Java SDK install page to main. - Revert versioned_docs/version-3.0.0 Java SDK install page to main. - Keep Java dynamic dedup documentation only in version-4.0.0. Signed-off-by: Asish Kumar --- .../keploy-cloud/deduplication.md | 2 +- .../server/sdk-installation/java.md | 187 +++++++++-------- .../server/sdk-installation/java.md | 196 ++++++++++-------- 3 files changed, 200 insertions(+), 185 deletions(-) diff --git a/versioned_docs/version-2.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-2.0.0/keploy-cloud/deduplication.md index ebf2c2c63..0b1d00e2d 100644 --- a/versioned_docs/version-2.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-2.0.0/keploy-cloud/deduplication.md @@ -78,7 +78,7 @@ Put the latest keploy-sdk in your pom.xml file : - io.keploy keploy-sdk - 2.0.0 + 0.0.1-SNAPSHOT ``` diff --git a/versioned_docs/version-2.0.0/server/sdk-installation/java.md b/versioned_docs/version-2.0.0/server/sdk-installation/java.md index b39378453..97a6070c6 100644 --- a/versioned_docs/version-2.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-2.0.0/server/sdk-installation/java.md @@ -1,121 +1,120 @@ --- id: java -title: Java SDK for Dynamic Deduplication +title: Merge Unit Test Coverage Data sidebar_label: Java -description: "Configure the Keploy Java SDK for Enterprise dynamic deduplication with JaCoCo TCP server mode." tags: - java - coverage - - deduplication keywords: - - Java - - JaCoCo + - MongoDB + - Jacoco - Maven - - Spring Boot - - dynamic deduplication + - Springboot Framework + - Postgres + - SQL + - Java + - API Test generator + - Auto Testcase generation + - Junit --- -The Java SDK is used for Enterprise dynamic deduplication during replay/test mode. It collects per-testcase Java coverage and sends it to Keploy Enterprise so duplicate testcases can be identified. - -The Java SDK does not record API traffic or mock dependencies. Record your Keploy tests separately, commit the generated test fixtures when you use them in CI, and run Java dedup during `keploy test --dedup`. - -## Requirements - -- Java 8, 17, or 21 -- `io.keploy:keploy-sdk` -- JaCoCo runtime agent in TCP server mode -- Keploy Enterprise with dynamic deduplication enabled +import WhatAreKeployFeatures from './index.md' -## Add the SDK + -Add the Keploy Java SDK dependency: +## πŸ› οΈ Language Specific Requirements -```xml - - io.keploy - keploy-sdk - 2.0.0 - -``` - -## Start the Dedup Agent +| Programming Language | Prerequisites | +| :------------------: | :------------- | +| java | [Jacoco 0.8.8] | -For Spring Boot 2 or other `javax.servlet` applications, import the middleware: - -```java -import io.keploy.servlet.KeployMiddleware; -import org.springframework.context.annotation.Import; - -@Import(KeployMiddleware.class) -public class Application { -} -``` - -For Spring Boot 3, Jakarta EE applications, other frameworks, or custom launchers, start the agent during application startup: - -```java -import io.keploy.dedup.KeployDedupAgent; - -KeployDedupAgent.start(); -``` - -## Run with the JaCoCo Java Agent - -The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo agent is enough β€” no TCP server flags, no port choice: +**Note**: In case of java application, before running test subcommand, you need to clean the project by removing any previously generated file, and run install command. ```bash -java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar +mvn clean install -Dmaven.test.skip=true ``` -If your compiled application classes are not under `target/classes` or `build/classes/java/main`, set `KEPLOY_JAVA_CLASS_DIRS`: +## Usage -```bash -export KEPLOY_JAVA_CLASS_DIRS=/absolute/path/to/target/classes -``` +### Update `pom.xml` file -If the in-process API is unavailable in your environment, the SDK transparently falls back to JaCoCo's TCP server mode. To use the fallback explicitly, launch JaCoCo in `tcpserver` mode and configure `KEPLOY_JACOCO_HOST` / `KEPLOY_JACOCO_PORT` (defaults: `127.0.0.1:36320`): +You will need to add the following plugins in `pom.xml` file of your application. :- -```bash -java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,output=tcpserver \ - -jar target/app.jar -``` - -## Replay with Dedup - -Run Keploy in test mode with dynamic deduplication enabled: - -```bash -keploy test \ - -c "java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar" \ - --dedup \ - --language java -``` - -If you are using the JaCoCo TCP fallback, also pass `--pass-through-ports ` so Keploy does not try to mock the coverage-control connection. - -After replay, run: - -```bash -keploy dedup +```xml + + + + + org.jacoco + jacoco-maven-plugin + 0.8.8 + + + + prepare-agent + + prepare-agent + + + + + merge-ut-e2e + test + + merge + + + + + ${project.build.directory} + + jacoco.exec + keploy-e2e.exec + + + + + ${project.build.directory}/ut-e2e-merged.exec + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/jacoco.exec + + ${project.reporting.outputDirectory}/ut + + + + + combined-ut-e2e + test + + report + + + ${project.build.directory}/ut-e2e-merged.exec + + ${project.reporting.outputDirectory}/e2e-ut-aggregate + + + + + + + ``` -To remove duplicate testcases: +Now, To get the combined report as well as coverage report for your unit tests, Run ```bash -keploy dedup --rm +mvn test ``` -## Docker and Restricted Docker - -Java dedup uses two Unix sockets shared between Keploy Enterprise and the Java process: - -- `/tmp/coverage_control.sock` -- `/tmp/coverage_data.sock` - -For Docker or Docker Compose runs, bind-mount host `/tmp` into the application container as `/tmp` so both processes use the same socket paths. Keep `/tmp` writable even when the root filesystem is read-only. - -For restricted containers, the application can run as a non-root user with dropped capabilities and `no-new-privileges` as long as `/tmp` is shared and writable, and the JaCoCo TCP port is reachable from the Java process. - -## CI Guidance - -CI should run replay/test mode against checked-in Keploy test fixtures. Do not record Java dedup fixtures in the pipeline unless you intentionally want to refresh them. +The html file for unit tests report would be generated in target/site/ut directory and, for combined report it would be generated in target/site/e2e-ut-aggregate directory. Open index.html to visualize the report. diff --git a/versioned_docs/version-3.0.0/server/sdk-installation/java.md b/versioned_docs/version-3.0.0/server/sdk-installation/java.md index a663441b5..2f61b982b 100644 --- a/versioned_docs/version-3.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-3.0.0/server/sdk-installation/java.md @@ -1,125 +1,141 @@ --- id: java -title: Java SDK for Dynamic Deduplication +title: Merge Unit and Keploy Test Coverage Data sidebar_label: Java -description: "Configure the Keploy Java SDK for Enterprise dynamic deduplication with JaCoCo TCP server mode." tags: - java - coverage - - deduplication keywords: - - Java - - JaCoCo + - MongoDB + - Jacoco - Maven - - Spring Boot - - dynamic deduplication + - Springboot Framework + - Postgres + - SQL + - Java + - API Test generator + - Auto Testcase generation + - Junit --- import ProductTier from '@site/src/components/ProductTier'; - - -The Java SDK is used for Enterprise dynamic deduplication during replay/test mode. It collects per-testcase Java coverage and sends it to Keploy Enterprise so duplicate testcases can be identified. - -The Java SDK does not record API traffic or mock dependencies. Record your Keploy tests separately, commit the generated test fixtures when you use them in CI, and run Java dedup during `keploy test --dedup`. - -## Requirements + -- Java 8, 17, or 21 -- `io.keploy:keploy-sdk` -- JaCoCo runtime agent in TCP server mode -- Keploy Enterprise with dynamic deduplication enabled +## πŸ› οΈ Language Specific Requirements -## Add the SDK +| Programming Language | Prerequisites | +| :------------------: | :------------- | +| java | [Jacoco 0.8.8] | -Add the Keploy Java SDK dependency: +**Note**: In case of java application, before running test subcommand, you need to clean the project by removing any previously generated file, and run install command. -```xml - - io.keploy - keploy-sdk - 2.0.0 - +```bash +mvn clean install -Dmaven.test.skip=true ``` -## Start the Dedup Agent +## Usage -For Spring Boot 2 or other `javax.servlet` applications, import the middleware: +### Update `pom.xml` file -```java -import io.keploy.servlet.KeployMiddleware; -import org.springframework.context.annotation.Import; +You will need to add the following plugins in `pom.xml` file of your application. :- -@Import(KeployMiddleware.class) -public class Application { -} +```xml + + + + + org.jacoco + jacoco-maven-plugin + 0.8.8 + + + + prepare-agent + + prepare-agent + + + + + merge-ut-e2e + test + + merge + + + + + ${project.build.directory} + + jacoco.exec + keploy-e2e.exec + + + + + ${project.build.directory}/ut-e2e-merged.exec + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/jacoco.exec + + ${project.reporting.outputDirectory}/ut + + + + + combined-ut-e2e + test + + report + + + ${project.build.directory}/ut-e2e-merged.exec + + ${project.reporting.outputDirectory}/e2e-ut-aggregate + + + + + + + ``` -For Spring Boot 3, Jakarta EE applications, other frameworks, or custom launchers, start the agent during application startup: - -```java -import io.keploy.dedup.KeployDedupAgent; +Once it has been done, run keploy test command: -KeployDedupAgent.start(); ``` - -## Run with the JaCoCo Java Agent - -The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo agent is enough β€” no TCP server flags, no port choice: - -```bash -java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar +keploy test -c "your_application_command" ``` -If your compiled application classes are not under `target/classes` or `build/classes/java/main`, set `KEPLOY_JAVA_CLASS_DIRS`: +After successful execution of this command, A coverage report would be generated inside the test-run folder of keploy/reports. -```bash -export KEPLOY_JAVA_CLASS_DIRS=/absolute/path/to/target/classes ``` - -If the in-process API is unavailable in your environment, the SDK transparently falls back to JaCoCo's TCP server mode. To use the fallback explicitly, launch JaCoCo in `tcpserver` mode and configure `KEPLOY_JACOCO_HOST` / `KEPLOY_JACOCO_PORT` (defaults: `127.0.0.1:36320`): - -```bash -java -javaagent:/path/to/jacocoagent.jar=address=127.0.0.1,port=36320,output=tcpserver \ - -jar target/app.jar +keploy +β”œβ”€β”€ reports +β”‚ └── test-run-0 +β”‚ β”œβ”€β”€ coverage.yaml +β”‚ └── test-set-0-report.yaml +└── test-set-0 + β”œβ”€β”€ mocks.yaml + └── tests + β”œβ”€β”€ test-1.yaml + └── test-2.yaml ``` -## Replay with Dedup - -Run Keploy in test mode with dynamic deduplication enabled: - -```bash -keploy test \ - -c "java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar" \ - --dedup \ - --language java -``` - -If you are using the JaCoCo TCP fallback, also pass `--pass-through-ports ` so Keploy does not try to mock the coverage-control connection. - -After replay, run: - -```bash -keploy dedup -``` - -To remove duplicate testcases: +Now, To get the combined report as well as coverage report for your unit tests, Run ```bash -keploy dedup --rm +mvn test ``` -## Docker and Restricted Docker - -Java dedup uses two Unix sockets shared between Keploy Enterprise and the Java process: - -- `/tmp/coverage_control.sock` -- `/tmp/coverage_data.sock` - -For Docker or Docker Compose runs, bind-mount host `/tmp` into the application container as `/tmp` so both processes use the same socket paths. Keep `/tmp` writable even when the root filesystem is read-only. - -For restricted containers, the application can run as a non-root user with dropped capabilities and `no-new-privileges` as long as `/tmp` is shared and writable, and the JaCoCo TCP port is reachable from the Java process. - -## CI Guidance - -CI should run replay/test mode against checked-in Keploy test fixtures. Do not record Java dedup fixtures in the pipeline unless you intentionally want to refresh them. +The html file for unit tests report would be generated in target/site/ut directory and, for combined report it would be generated in target/site/e2e-ut-aggregate directory. Open index.html to visualize the report. From d07ff8de4b019dae502b2c291389c6e5dd3a3436 Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Sun, 26 Apr 2026 16:43:43 +0530 Subject: [PATCH 13/18] docs(dedup): improve v4 dedup page navigation and reorder Golang first - Reorder so the Golang section appears before the Java section. - Promote bold subsection labels to H4 headings so each numbered step shows up in the right-side table of contents. - Set toc_max_heading_level: 4 in the page front-matter so Docusaurus renders the new H4 anchors in the sidebar. Signed-off-by: Asish Kumar --- .../keploy-cloud/deduplication.md | 171 +++++++++--------- 1 file changed, 86 insertions(+), 85 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index 1cb511de1..02c6a7681 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -3,6 +3,7 @@ id: deduplication title: Remove Duplicates Tests sidebar_label: Remove Duplicate Tests description: "Remove duplicate test cases with Keploy Enterprise deduplication β€” save time and resources by eliminating redundant tests." +toc_max_heading_level: 4 tags: - explanation - feature guide @@ -34,9 +35,90 @@ To detect duplicate tests, simply run the below command, like so: keploy test -c "docker compose up" --containerName containerName --dedup ``` +### For Golang Applications + +#### 1. Pre-requisite + +Install the `keploy/go-sdk/v3/keploy` : - + +```bash +go get github.com/keploy/go-sdk/v3/keploy +``` + +Add the following on top of your main application file : - + +```bash +import _ "github.com/keploy/go-sdk/v3/keploy" +``` + +#### 2. Build Configuration + +Update the `go build` command in your Dockerfile (or native build script) to include coverage flags. These are required for deduplication to calculate coverage accurately. + +```bash +RUN go build -cover -covermode=atomic -coverpkg=./... -o /app/main . +``` + +#### 3. Dockerfile Configuration (Important for Docker Users) + +If you are using a multi-stage Docker build (e.g., building in one stage and running in a slim image), you **must** ensure the Go toolchain and `go.mod` files are preserved in the final runtime image. The deduplication feature requires access to the Go runtime to map coverage data correctly. + +Update your final runtime stage in the `Dockerfile` to include the following: + +```dockerfile +# ... inside your final runtime stage ... + +# 1. Copy Go toolchain from the builder stage +COPY --from=builder /usr/local/go /usr/local/go + +# 2. Set Go environment variables so the app can use internal go tools +ENV GOROOT=/usr/local/go +ENV PATH=/usr/local/go/bin:${PATH} + +# 3. Copy go.mod and go.sum (Required for dependency resolution during coverage) +COPY --from=builder /src/go.mod /src/go.sum /app/ + +# 4. Set the GOMOD environment variable +ENV GOMOD=/app/go.mod + +# ... rest of your dockerfile ... +``` + +> **Note:** If you face issues with toolchain downloads in restricted environments, you may also need to set `ENV GOTOOLCHAIN=local` and configure your `GOPROXY` in the Dockerfile. + +#### 4. Run Deduplication + +For Docker, run: + +```bash +keploy test -c "docker compose up" --containerName containerName --dedup +``` + +For Native, run: + +```bash +keploy test -c ./main --dedup +``` + +This will generate a `dedupData.yaml` file. + +After this, run: + +```bash +keploy dedup +``` + +This command will create a `duplicates.yaml` file which will contain all the test cases which were found to be duplicate. + +In order to remove all the duplicate test cases, run the following command: + +```bash +keploy dedup --rm +``` + ### For Java Applications -**1. Pre-requisite** +#### 1. Pre-requisite Add the Keploy Java SDK to your application: @@ -76,7 +158,7 @@ java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=363 The default JaCoCo endpoint for the fallback is `127.0.0.1:36320`. You can override it with `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT`, or with the JVM properties `keploy.jacoco.host` and `keploy.jacoco.port`. When using the fallback, add the JaCoCo port to `--pass-through-ports` so coverage-control traffic is not mocked. -**2. Build Configuration** +#### 2. Build Configuration Build the application before running Keploy so the Java class files are available for coverage analysis: @@ -86,7 +168,7 @@ mvn clean package -DskipTests By default, the SDK scans `target/classes`, `build/classes/java/main`, and runtime classpath jars. For custom layouts or restricted Docker images, set `KEPLOY_JAVA_CLASS_DIRS` to the class directories or jars that should be analyzed. -**3. Dockerfile Configuration (Important for Docker Users)** +#### 3. Dockerfile Configuration (Important for Docker Users) When you use Docker or Docker Compose, make sure the final runtime image contains: @@ -112,7 +194,7 @@ Keploy and the Java SDK exchange per-test coverage signals over `/tmp/coverage_c For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and host `/tmp` bind-mounted into the container for the Keploy control/data sockets and JaCoCo output. Do not replace the shared `/tmp` bind mount with a container-only `tmpfs` or named volume; Keploy on the host will not be able to reach the Java SDK control socket. -**4. Run Deduplication** +#### 4. Run Deduplication For Docker, run: @@ -143,84 +225,3 @@ In order to remove all the duplicate test cases, run the following command: ```bash keploy dedup --rm ``` - -### For Golang Applications - -**1. Pre-requisite** - -Install the `keploy/go-sdk/v3/keploy` : - - -```bash -go get github.com/keploy/go-sdk/v3/keploy -``` - -Add the following on top of your main application file : - - -```bash -import _ "github.com/keploy/go-sdk/v3/keploy" -``` - -**2. Build Configuration** - -Update the `go build` command in your Dockerfile (or native build script) to include coverage flags. These are required for deduplication to calculate coverage accurately. - -```bash -RUN go build -cover -covermode=atomic -coverpkg=./... -o /app/main . -``` - -**3. Dockerfile Configuration (Important for Docker Users)** - -If you are using a multi-stage Docker build (e.g., building in one stage and running in a slim image), you **must** ensure the Go toolchain and `go.mod` files are preserved in the final runtime image. The deduplication feature requires access to the Go runtime to map coverage data correctly. - -Update your final runtime stage in the `Dockerfile` to include the following: - -```dockerfile -# ... inside your final runtime stage ... - -# 1. Copy Go toolchain from the builder stage -COPY --from=builder /usr/local/go /usr/local/go - -# 2. Set Go environment variables so the app can use internal go tools -ENV GOROOT=/usr/local/go -ENV PATH=/usr/local/go/bin:${PATH} - -# 3. Copy go.mod and go.sum (Required for dependency resolution during coverage) -COPY --from=builder /src/go.mod /src/go.sum /app/ - -# 4. Set the GOMOD environment variable -ENV GOMOD=/app/go.mod - -# ... rest of your dockerfile ... -``` - -> **Note:** If you face issues with toolchain downloads in restricted environments, you may also need to set `ENV GOTOOLCHAIN=local` and configure your `GOPROXY` in the Dockerfile. - -**4. Run Deduplication** - -For Docker, run: - -```bash -keploy test -c "docker compose up" --containerName containerName --dedup -``` - -For Native, run: - -```bash -keploy test -c ./main --dedup -``` - -This will generate a `dedupData.yaml` file. - -After this, run: - -```bash -keploy dedup -``` - -This command will create a `duplicates.yaml` file which will contain all the test cases which were found to be duplicate. - -In order to remove all the duplicate test cases, run the following command: - -```bash -keploy dedup --rm -``` From 385b5645aafd3b8b5424e21ed540e8b78d740c7f Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Sun, 26 Apr 2026 16:46:27 +0530 Subject: [PATCH 14/18] docs(dedup): match existing dedup page heading pattern - Revert numbered steps from H4 headings back to bold labels so the page matches the established pattern used elsewhere in the docs and the Golang section as it stood on main. - Drop the toc_max_heading_level front-matter override. - Keep the Golang-first section order so Java is documented underneath. Signed-off-by: Asish Kumar --- .../version-4.0.0/keploy-cloud/deduplication.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index 02c6a7681..df44daaaa 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -3,7 +3,6 @@ id: deduplication title: Remove Duplicates Tests sidebar_label: Remove Duplicate Tests description: "Remove duplicate test cases with Keploy Enterprise deduplication β€” save time and resources by eliminating redundant tests." -toc_max_heading_level: 4 tags: - explanation - feature guide @@ -37,7 +36,7 @@ keploy test -c "docker compose up" --containerName containerName --dedup ### For Golang Applications -#### 1. Pre-requisite +**1. Pre-requisite** Install the `keploy/go-sdk/v3/keploy` : - @@ -51,7 +50,7 @@ Add the following on top of your main application file : - import _ "github.com/keploy/go-sdk/v3/keploy" ``` -#### 2. Build Configuration +**2. Build Configuration** Update the `go build` command in your Dockerfile (or native build script) to include coverage flags. These are required for deduplication to calculate coverage accurately. @@ -59,7 +58,7 @@ Update the `go build` command in your Dockerfile (or native build script) to inc RUN go build -cover -covermode=atomic -coverpkg=./... -o /app/main . ``` -#### 3. Dockerfile Configuration (Important for Docker Users) +**3. Dockerfile Configuration (Important for Docker Users)** If you are using a multi-stage Docker build (e.g., building in one stage and running in a slim image), you **must** ensure the Go toolchain and `go.mod` files are preserved in the final runtime image. The deduplication feature requires access to the Go runtime to map coverage data correctly. @@ -86,7 +85,7 @@ ENV GOMOD=/app/go.mod > **Note:** If you face issues with toolchain downloads in restricted environments, you may also need to set `ENV GOTOOLCHAIN=local` and configure your `GOPROXY` in the Dockerfile. -#### 4. Run Deduplication +**4. Run Deduplication** For Docker, run: @@ -118,7 +117,7 @@ keploy dedup --rm ### For Java Applications -#### 1. Pre-requisite +**1. Pre-requisite** Add the Keploy Java SDK to your application: @@ -158,7 +157,7 @@ java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=363 The default JaCoCo endpoint for the fallback is `127.0.0.1:36320`. You can override it with `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT`, or with the JVM properties `keploy.jacoco.host` and `keploy.jacoco.port`. When using the fallback, add the JaCoCo port to `--pass-through-ports` so coverage-control traffic is not mocked. -#### 2. Build Configuration +**2. Build Configuration** Build the application before running Keploy so the Java class files are available for coverage analysis: @@ -168,7 +167,7 @@ mvn clean package -DskipTests By default, the SDK scans `target/classes`, `build/classes/java/main`, and runtime classpath jars. For custom layouts or restricted Docker images, set `KEPLOY_JAVA_CLASS_DIRS` to the class directories or jars that should be analyzed. -#### 3. Dockerfile Configuration (Important for Docker Users) +**3. Dockerfile Configuration (Important for Docker Users)** When you use Docker or Docker Compose, make sure the final runtime image contains: @@ -194,7 +193,7 @@ Keploy and the Java SDK exchange per-test coverage signals over `/tmp/coverage_c For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and host `/tmp` bind-mounted into the container for the Keploy control/data sockets and JaCoCo output. Do not replace the shared `/tmp` bind mount with a container-only `tmpfs` or named volume; Keploy on the host will not be able to reach the Java SDK control socket. -#### 4. Run Deduplication +**4. Run Deduplication** For Docker, run: From 82631ce7c290736c7f8334e8959a103a4a7eee6c Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Sun, 26 Apr 2026 16:52:41 +0530 Subject: [PATCH 15/18] docs(dedup): expose step headings in v4 dedup TOC - Convert numbered step labels (Pre-requisite, Build Configuration, Dockerfile Configuration, Run Deduplication) from bold paragraphs to H4 headings under both Golang and Java sections. - Set toc_max_heading_level to 4 so the steps appear in the "On this page" sidebar, making the page easier to navigate. Signed-off-by: Asish Kumar --- .../keploy-cloud/deduplication.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index df44daaaa..b5cbe7570 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -14,6 +14,8 @@ keywords: - duplicate tests - golang - testcases +toc_min_heading_level: 2 +toc_max_heading_level: 4 --- import ProductTier from '@site/src/components/ProductTier'; @@ -36,7 +38,7 @@ keploy test -c "docker compose up" --containerName containerName --dedup ### For Golang Applications -**1. Pre-requisite** +#### 1. Pre-requisite Install the `keploy/go-sdk/v3/keploy` : - @@ -50,7 +52,7 @@ Add the following on top of your main application file : - import _ "github.com/keploy/go-sdk/v3/keploy" ``` -**2. Build Configuration** +#### 2. Build Configuration Update the `go build` command in your Dockerfile (or native build script) to include coverage flags. These are required for deduplication to calculate coverage accurately. @@ -58,7 +60,7 @@ Update the `go build` command in your Dockerfile (or native build script) to inc RUN go build -cover -covermode=atomic -coverpkg=./... -o /app/main . ``` -**3. Dockerfile Configuration (Important for Docker Users)** +#### 3. Dockerfile Configuration (Important for Docker Users) If you are using a multi-stage Docker build (e.g., building in one stage and running in a slim image), you **must** ensure the Go toolchain and `go.mod` files are preserved in the final runtime image. The deduplication feature requires access to the Go runtime to map coverage data correctly. @@ -85,7 +87,7 @@ ENV GOMOD=/app/go.mod > **Note:** If you face issues with toolchain downloads in restricted environments, you may also need to set `ENV GOTOOLCHAIN=local` and configure your `GOPROXY` in the Dockerfile. -**4. Run Deduplication** +#### 4. Run Deduplication For Docker, run: @@ -117,7 +119,7 @@ keploy dedup --rm ### For Java Applications -**1. Pre-requisite** +#### 1. Pre-requisite Add the Keploy Java SDK to your application: @@ -157,7 +159,7 @@ java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=363 The default JaCoCo endpoint for the fallback is `127.0.0.1:36320`. You can override it with `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT`, or with the JVM properties `keploy.jacoco.host` and `keploy.jacoco.port`. When using the fallback, add the JaCoCo port to `--pass-through-ports` so coverage-control traffic is not mocked. -**2. Build Configuration** +#### 2. Build Configuration Build the application before running Keploy so the Java class files are available for coverage analysis: @@ -167,7 +169,7 @@ mvn clean package -DskipTests By default, the SDK scans `target/classes`, `build/classes/java/main`, and runtime classpath jars. For custom layouts or restricted Docker images, set `KEPLOY_JAVA_CLASS_DIRS` to the class directories or jars that should be analyzed. -**3. Dockerfile Configuration (Important for Docker Users)** +#### 3. Dockerfile Configuration (Important for Docker Users) When you use Docker or Docker Compose, make sure the final runtime image contains: @@ -193,7 +195,7 @@ Keploy and the Java SDK exchange per-test coverage signals over `/tmp/coverage_c For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and host `/tmp` bind-mounted into the container for the Keploy control/data sockets and JaCoCo output. Do not replace the shared `/tmp` bind mount with a container-only `tmpfs` or named volume; Keploy on the host will not be able to reach the Java SDK control socket. -**4. Run Deduplication** +#### 4. Run Deduplication For Docker, run: From ce3d82a422618b590e44028c1df28dd944ed798d Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Mon, 27 Apr 2026 17:14:54 +0530 Subject: [PATCH 16/18] fix: align java dedup docs with runtime behavior Signed-off-by: Asish Kumar --- .../version-4.0.0/keploy-cloud/deduplication.md | 10 +++++----- .../version-4.0.0/server/sdk-installation/java.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index b5cbe7570..59791d414 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -2,7 +2,7 @@ id: deduplication title: Remove Duplicates Tests sidebar_label: Remove Duplicate Tests -description: "Remove duplicate test cases with Keploy Enterprise deduplication β€” save time and resources by eliminating redundant tests." +description: "Remove duplicate test cases with Keploy Enterprise deduplication and save time and resources by eliminating redundant tests." tags: - explanation - feature guide @@ -144,13 +144,13 @@ public class App { } ``` -Java dynamic deduplication uses JaCoCo runtime coverage. The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo Java agent is enough β€” no TCP server flags, no `--pass-through-ports`: +Java dynamic deduplication uses JaCoCo runtime coverage. The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo Java agent is enough: no TCP server flags, no `--pass-through-ports`. ```bash java -javaagent:/path/to/org.jacoco.agent-runtime.jar -jar target/app.jar ``` -If the in-process API is unavailable for some reason (for example, an isolated classloader), the SDK transparently falls back to JaCoCo's TCP server mode. To force the fallback, launch JaCoCo in `tcpserver` mode and tell Keploy to leave that port alone: +If the in-process API is unavailable for some reason (for example, an isolated class loader), the SDK transparently falls back to JaCoCo's TCP server mode. To force the fallback, launch JaCoCo in `tcpserver` mode and tell Keploy to leave that port alone: ```bash java -javaagent:/path/to/org.jacoco.agent-runtime.jar=address=127.0.0.1,port=36320,output=tcpserver \ @@ -191,9 +191,9 @@ Then run the app with the JaCoCo agent attached: java -javaagent:/app/jacocoagent.jar -jar /app/app.jar ``` -Keploy and the Java SDK exchange per-test coverage signals over `/tmp/coverage_control.sock` and `/tmp/coverage_data.sock`. For Docker and Docker Compose, bind-mount host `/tmp` into the application container so both processes see the same socket paths. +Keploy and the Java SDK exchange per-test coverage signals over `/tmp/coverage_control.sock` and `/tmp/coverage_data.sock`. For Docker and Docker Compose, Keploy injects a shared `keploy-sockets-vol:/tmp` mount into the application container and the Keploy agent container so both processes see the same socket paths. -For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and host `/tmp` bind-mounted into the container for the Keploy control/data sockets and JaCoCo output. Do not replace the shared `/tmp` bind mount with a container-only `tmpfs` or named volume; Keploy on the host will not be able to reach the Java SDK control socket. +For hardened Docker runs, the Java dedup sample is validated with a non-root runtime user, a read-only root filesystem, dropped Linux capabilities, `no-new-privileges`, and Keploy's shared `/tmp` named volume for the Keploy control/data sockets and JaCoCo output. Do not add a conflicting `/tmp` bind mount or `tmpfs`; Keploy requires the injected shared `/tmp` volume to reach the Java SDK control socket. #### 4. Run Deduplication diff --git a/versioned_docs/version-4.0.0/server/sdk-installation/java.md b/versioned_docs/version-4.0.0/server/sdk-installation/java.md index a663441b5..0ba88376f 100644 --- a/versioned_docs/version-4.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-4.0.0/server/sdk-installation/java.md @@ -2,7 +2,7 @@ id: java title: Java SDK for Dynamic Deduplication sidebar_label: Java -description: "Configure the Keploy Java SDK for Enterprise dynamic deduplication with JaCoCo TCP server mode." +description: "Configure the Keploy Java SDK for Enterprise dynamic deduplication with in-process JaCoCo coverage." tags: - java - coverage @@ -27,7 +27,7 @@ The Java SDK does not record API traffic or mock dependencies. Record your Keplo - Java 8, 17, or 21 - `io.keploy:keploy-sdk` -- JaCoCo runtime agent in TCP server mode +- JaCoCo Java agent attached to the application JVM - Keploy Enterprise with dynamic deduplication enabled ## Add the SDK @@ -65,7 +65,7 @@ KeployDedupAgent.start(); ## Run with the JaCoCo Java Agent -The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo agent is enough β€” no TCP server flags, no port choice: +The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo agent is enough: no TCP server flags, no port choice. ```bash java -javaagent:/path/to/jacocoagent.jar -jar target/app.jar @@ -116,9 +116,9 @@ Java dedup uses two Unix sockets shared between Keploy Enterprise and the Java p - `/tmp/coverage_control.sock` - `/tmp/coverage_data.sock` -For Docker or Docker Compose runs, bind-mount host `/tmp` into the application container as `/tmp` so both processes use the same socket paths. Keep `/tmp` writable even when the root filesystem is read-only. +For Docker or Docker Compose runs, Keploy injects a shared `keploy-sockets-vol:/tmp` mount into the application container and the Keploy agent container so both processes use the same socket paths. Do not add a conflicting `/tmp` bind mount or `tmpfs`; keep `/tmp` writable even when the root filesystem is read-only. -For restricted containers, the application can run as a non-root user with dropped capabilities and `no-new-privileges` as long as `/tmp` is shared and writable, and the JaCoCo TCP port is reachable from the Java process. +For restricted containers, the application can run as a non-root user with dropped capabilities and `no-new-privileges` as long as the injected `/tmp` volume is shared and writable. If the SDK falls back to JaCoCo TCP mode, the JaCoCo TCP port must also be reachable from the Java process. ## CI Guidance From 900b4ab461fe442bb6fc28c8b2e32ca4e94ff14d Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Mon, 27 Apr 2026 18:00:40 +0530 Subject: [PATCH 17/18] docs: rename dedup page to dynamic deduplication Signed-off-by: Asish Kumar --- versioned_docs/version-4.0.0/keploy-cloud/deduplication.md | 6 +++--- .../version-4.0.0/keploy-cloud/static-deduplication.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index 59791d414..25de97b94 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -1,8 +1,8 @@ --- id: deduplication -title: Remove Duplicates Tests -sidebar_label: Remove Duplicate Tests -description: "Remove duplicate test cases with Keploy Enterprise deduplication and save time and resources by eliminating redundant tests." +title: Dynamic Deduplication +sidebar_label: Dynamic Deduplication +description: "Use Keploy Enterprise dynamic deduplication to identify redundant test cases and save time and resources." tags: - explanation - feature guide diff --git a/versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md index 72836f60b..6855fe19a 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md @@ -185,6 +185,6 @@ Pair with [recording filters](/docs/running-keploy/recording-filters/) when you ## Related guides -- [Remove Duplicate Tests (coverage-based dedup)](/docs/keploy-cloud/deduplication/)β€”post-replay dedup with `keploy dedup`. +- [Dynamic Deduplication (coverage-based dedup)](/docs/keploy-cloud/deduplication/)β€”post-replay dedup with `keploy dedup`. - [Recording filters](/docs/running-keploy/recording-filters/)β€”exclude traffic before it reaches dedup. - [Configuration file](/docs/running-keploy/configuration-file/)β€”all `keploy.yml` options in one place. From 88662c0099aba3f7ad4512da7f0d2904d04afeee Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Tue, 28 Apr 2026 01:43:39 +0530 Subject: [PATCH 18/18] docs: refine Java dynamic dedup guide Keep the Java guide aligned with the released SDK and restore unrelated docs text. Signed-off-by: Asish Kumar --- .../keploy-cloud/deduplication.md | 30 ++++++++++++------- .../keploy-cloud/static-deduplication.md | 2 +- .../server/sdk-installation/java.md | 2 +- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md index 25de97b94..f06c8a185 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/deduplication.md @@ -22,15 +22,15 @@ import ProductTier from '@site/src/components/ProductTier'; -## Why Deduplication? ❄️ +## Why Dynamic Deduplication? ❄️ When developing or maintaining a software, it is common for test suites to grow in size. This often results in redundancy, as many test cases cover the same functions or scenarios. This is where Test Deduplication comes into play. -It simplifies the testing process by removing redundant test cases, which saves time and resources while keeping the testcases which adds value to the overall coverage of the application. +It simplifies the testing process by identifying redundant test cases, which saves time and resources while keeping the testcases that add value to the overall coverage of the application. ## Usage πŸ› οΈ -To detect duplicate tests, simply run the below command, like so: +To collect coverage for dynamic deduplication, run: ```bash keploy test -c "docker compose up" --containerName containerName --dedup @@ -38,7 +38,7 @@ keploy test -c "docker compose up" --containerName containerName --dedup ### For Golang Applications -#### 1. Pre-requisite +**1. Pre-requisite** Install the `keploy/go-sdk/v3/keploy` : - @@ -52,7 +52,7 @@ Add the following on top of your main application file : - import _ "github.com/keploy/go-sdk/v3/keploy" ``` -#### 2. Build Configuration +**2. Build Configuration** Update the `go build` command in your Dockerfile (or native build script) to include coverage flags. These are required for deduplication to calculate coverage accurately. @@ -60,7 +60,7 @@ Update the `go build` command in your Dockerfile (or native build script) to inc RUN go build -cover -covermode=atomic -coverpkg=./... -o /app/main . ``` -#### 3. Dockerfile Configuration (Important for Docker Users) +**3. Dockerfile Configuration (Important for Docker Users)** If you are using a multi-stage Docker build (e.g., building in one stage and running in a slim image), you **must** ensure the Go toolchain and `go.mod` files are preserved in the final runtime image. The deduplication feature requires access to the Go runtime to map coverage data correctly. @@ -87,7 +87,7 @@ ENV GOMOD=/app/go.mod > **Note:** If you face issues with toolchain downloads in restricted environments, you may also need to set `ENV GOTOOLCHAIN=local` and configure your `GOPROXY` in the Dockerfile. -#### 4. Run Deduplication +**4. Run Deduplication** For Docker, run: @@ -131,7 +131,7 @@ Add the Keploy Java SDK to your application: ``` -For Spring Boot applications, register the Keploy middleware in your main class: +For Spring Boot 2 or other `javax.servlet` applications, register the Keploy middleware in your main class: ```java import io.keploy.servlet.KeployMiddleware; @@ -144,6 +144,14 @@ public class App { } ``` +For Spring Boot 3, Jakarta EE applications, other frameworks, or custom launchers, start the agent during application startup: + +```java +import io.keploy.dedup.KeployDedupAgent; + +KeployDedupAgent.start(); +``` + Java dynamic deduplication uses JaCoCo runtime coverage. The SDK reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo Java agent is enough: no TCP server flags, no `--pass-through-ports`. ```bash @@ -200,7 +208,7 @@ For hardened Docker runs, the Java dedup sample is validated with a non-root run For Docker, run: ```bash -keploy test -c "docker compose up" --containerName containerName --dedup --language java +keploy test -c "docker compose up" --container-name containerName --dedup --language java ``` For Native, run: @@ -219,9 +227,9 @@ After this, run: keploy dedup ``` -This command will create a `duplicates.yaml` file which will contain all the test cases which were found to be duplicate. +This command will create a `duplicates.yaml` file containing the test cases that dynamic deduplication marked as redundant. -In order to remove all the duplicate test cases, run the following command: +To apply the dynamic deduplication cleanup to the local Keploy test set, run: ```bash keploy dedup --rm diff --git a/versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md b/versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md index 6855fe19a..72836f60b 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md @@ -185,6 +185,6 @@ Pair with [recording filters](/docs/running-keploy/recording-filters/) when you ## Related guides -- [Dynamic Deduplication (coverage-based dedup)](/docs/keploy-cloud/deduplication/)β€”post-replay dedup with `keploy dedup`. +- [Remove Duplicate Tests (coverage-based dedup)](/docs/keploy-cloud/deduplication/)β€”post-replay dedup with `keploy dedup`. - [Recording filters](/docs/running-keploy/recording-filters/)β€”exclude traffic before it reaches dedup. - [Configuration file](/docs/running-keploy/configuration-file/)β€”all `keploy.yml` options in one place. diff --git a/versioned_docs/version-4.0.0/server/sdk-installation/java.md b/versioned_docs/version-4.0.0/server/sdk-installation/java.md index 0ba88376f..7a75d1ce0 100644 --- a/versioned_docs/version-4.0.0/server/sdk-installation/java.md +++ b/versioned_docs/version-4.0.0/server/sdk-installation/java.md @@ -103,7 +103,7 @@ After replay, run: keploy dedup ``` -To remove duplicate testcases: +To apply the dynamic deduplication cleanup: ```bash keploy dedup --rm