Skip to main content
Version: 2.0.0

Remove Duplicates Tests 🧹

Why Deduplication? ❄️

Test deduplication simplifies the testing process by removing redundant test cases, saving time and resources while clarifying the purpose and coverage of each test.

Why Deduplication? ⏳

When developing and maintaining software, it's common for test suites to grow in size, often resulting in redundancy where certain test cases cover the same functionality or scenarios.

Usage 🛠️

To detect duplicate tests, simply run the below command, like so:

keploy dedup -c "<CMD_TO_RUN_APP>"

For Node Applications

1. Pre-requsite

Install the keploy/sdk and nyc package : -

npm i @keploy/sdk nyc@15.0.0

Add the the following on top of your main application js file (index.js/server.js/app.js/main.js) : -

const kmiddleware = require('@keploy/sdk/dist/v2/dedup/middleware.js')


2. Run Deduplication

keploy dedup -c "<CMD_TO_RUN_APP>" --delay 10


Let's use the [expresss-mongoose] application to test dedup feature. In our src/app.js file we need to have imported and initialized @keploy/sdk package, so now let's run the de-duplication command to check : -

keploy dedup -c "node src/app.js" -t "test-set-1"

Voila! Keploy will now detect duplicate tests .

For Java Applications

1. Pre-requsite

Put the latest keploy-sdk in your pom.xml file : -


Now that we have added keploy-sdk, let's import it in our main class : -

import io.keploy.servlet.KeployMiddleware;

public class SamplesJavaApplication {
public static void main(String[] args) {, args);

2. Run Deduplication

We need to create Jar file via : -

mvn clean install -DskipTests

Once we have our jar file ready, we can run following command : -

keploy dedup -c "java -javaagent:<PATH_TO_JacocoAgent>=address=*,port=36320,destfile=jacoco-it.exec,output=tcpserver -jar <PATH_TO_JAR_FILE>"  --delay 10

Voila! Keploy will now detect duplicate tests .

Remove Duplicate Tests

You can simply remove duplicate tests with :

keploy dedup --rm