Skip to content

Commit 88662c0

Browse files
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 <officialasishkumar@gmail.com>
1 parent 900b4ab commit 88662c0

3 files changed

Lines changed: 21 additions & 13 deletions

File tree

versioned_docs/version-4.0.0/keploy-cloud/deduplication.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ import ProductTier from '@site/src/components/ProductTier';
2222

2323
<ProductTier tiers="Enterprise" offerings="Self-Hosted, Dedicated" />
2424

25-
## Why Deduplication? ❄️
25+
## Why Dynamic Deduplication? ❄️
2626

2727
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.
2828

29-
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.
29+
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.
3030

3131
## Usage 🛠️
3232

33-
To detect duplicate tests, simply run the below command, like so:
33+
To collect coverage for dynamic deduplication, run:
3434

3535
```bash
3636
keploy test -c "docker compose up" --containerName containerName --dedup
3737
```
3838

3939
### For Golang Applications
4040

41-
#### 1. Pre-requisite
41+
**1. Pre-requisite**
4242

4343
Install the `keploy/go-sdk/v3/keploy` : -
4444

@@ -52,15 +52,15 @@ Add the following on top of your main application file : -
5252
import _ "github.com/keploy/go-sdk/v3/keploy"
5353
```
5454

55-
#### 2. Build Configuration
55+
**2. Build Configuration**
5656

5757
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.
5858

5959
```bash
6060
RUN go build -cover -covermode=atomic -coverpkg=./... -o /app/main .
6161
```
6262

63-
#### 3. Dockerfile Configuration (Important for Docker Users)
63+
**3. Dockerfile Configuration (Important for Docker Users)**
6464

6565
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.
6666

@@ -87,7 +87,7 @@ ENV GOMOD=/app/go.mod
8787

8888
> **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.
8989
90-
#### 4. Run Deduplication
90+
**4. Run Deduplication**
9191

9292
For Docker, run:
9393

@@ -131,7 +131,7 @@ Add the Keploy Java SDK to your application:
131131
</dependency>
132132
```
133133

134-
For Spring Boot applications, register the Keploy middleware in your main class:
134+
For Spring Boot 2 or other `javax.servlet` applications, register the Keploy middleware in your main class:
135135

136136
```java
137137
import io.keploy.servlet.KeployMiddleware;
@@ -144,6 +144,14 @@ public class App {
144144
}
145145
```
146146

147+
For Spring Boot 3, Jakarta EE applications, other frameworks, or custom launchers, start the agent during application startup:
148+
149+
```java
150+
import io.keploy.dedup.KeployDedupAgent;
151+
152+
KeployDedupAgent.start();
153+
```
154+
147155
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`.
148156

149157
```bash
@@ -200,7 +208,7 @@ For hardened Docker runs, the Java dedup sample is validated with a non-root run
200208
For Docker, run:
201209

202210
```bash
203-
keploy test -c "docker compose up" --containerName containerName --dedup --language java
211+
keploy test -c "docker compose up" --container-name containerName --dedup --language java
204212
```
205213

206214
For Native, run:
@@ -219,9 +227,9 @@ After this, run:
219227
keploy dedup
220228
```
221229

222-
This command will create a `duplicates.yaml` file which will contain all the test cases which were found to be duplicate.
230+
This command will create a `duplicates.yaml` file containing the test cases that dynamic deduplication marked as redundant.
223231

224-
In order to remove all the duplicate test cases, run the following command:
232+
To apply the dynamic deduplication cleanup to the local Keploy test set, run:
225233

226234
```bash
227235
keploy dedup --rm

versioned_docs/version-4.0.0/keploy-cloud/static-deduplication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,6 @@ Pair with [recording filters](/docs/running-keploy/recording-filters/) when you
185185

186186
## Related guides
187187

188-
- [Dynamic Deduplication (coverage-based dedup)](/docs/keploy-cloud/deduplication/)—post-replay dedup with `keploy dedup`.
188+
- [Remove Duplicate Tests (coverage-based dedup)](/docs/keploy-cloud/deduplication/)—post-replay dedup with `keploy dedup`.
189189
- [Recording filters](/docs/running-keploy/recording-filters/)—exclude traffic before it reaches dedup.
190190
- [Configuration file](/docs/running-keploy/configuration-file/)—all `keploy.yml` options in one place.

versioned_docs/version-4.0.0/server/sdk-installation/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ After replay, run:
103103
keploy dedup
104104
```
105105

106-
To remove duplicate testcases:
106+
To apply the dynamic deduplication cleanup:
107107

108108
```bash
109109
keploy dedup --rm

0 commit comments

Comments
 (0)