Skip to content

Commit

Permalink
fix: docs structure
Browse files Browse the repository at this point in the history
Signed-off-by: Animesh Pathak <[email protected]>
  • Loading branch information
Sonichigo authored and actions-user committed Jul 26, 2024
1 parent a9a2c5e commit 2a7a2b5
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions versioned_docs/version-2.0.0/keploy-cloud/deduplication.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ sidebar_label: Remove Duplicate Tests 🧹
tags:
- explanation
- feature guide
- jwt
- Test Deduplication
keywords:
- dedup
- keploy cloud
- jwt
- deduplication
- duplicate tests
- python
- java
- nodejs
- node
- testcases
---

## Why Deduplication? ❄️
Expand Down Expand Up @@ -55,7 +58,7 @@ keploy dedup -c "<CMD_TO_RUN_APP>" --delay 10 -t="<TESTSETS_TO_RUN>"

#### Example

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 : -
Let's use the [expresss-mongoose](https://github.com/keploy/samples-typescript/tree/main/express-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 : -

```bash
keploy dedup -c "node src/app.js" -t "test-set-1"
Expand Down Expand Up @@ -108,15 +111,7 @@ keploy dedup -c "java -javaagent:<PATH_TO_JacocoAgent>=address=*,port=36320,dest

Voila! Keploy will now detect duplicate tests .

## Remove Duplicate Tests

You can simply remove duplicate tests with :

```bash
keploy dedup --rm
```

### De-Duplication for Python Applications
### For Python Applications

Deduplication works only on test mode there are no special instructions to record your tests.

Expand All @@ -132,29 +127,28 @@ In your main app file add the following with along with the other imports. And a

1. In FastAPI -

```
// existing imports
```py
# existing imports
from keploy import FastApiCoverageMiddleware

...
app.add_middleware(FastApiCoverageMiddleware)
# existing functions
```

2. In Flask -

```
// existing imports
```py
# existing imports
from keploy import FlaskCoverageMiddleware

...
app.wsgi_app = FlaskCoverageMiddleware(app.wsgi_app)

# existing functions
```

3. In Django - Open `settings.py` and add the middleware class to the **MIDDLEWARE** list.

```
```py
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand All @@ -174,12 +168,20 @@ MIDDLEWARE = [
Run keploy with test-sets in which you want to check for the duplicate testcases :

```sh
sudo -E env PATH=$PATH keploy dedup -c "<command to run your Python app>" --delay "<time required for your application to start>"
keploy dedup -c "<command to run your Python app>" --delay "<time required for your application to start>"
```

#### Example

Let's use the [flask-mongo](https://github.com/keploy/samples-python/tree/main/flask-mongo) application to test dedup feature. In our `app.py` file we need to have imported and initialized `keploy` package, since this is a flask application we can follow above flask approach. Once we have added package, let's run the de-duplication command to check : -

```bash
keploy dedup -c "python3 app.py" -t "test-set-1"
```

<img width="1111" alt="image" src="https://github.com/user-attachments/assets/03638c80-ae11-492f-9b4e-bce92d15a04e"/>

**3. Remove Duplicate Tests**
## Remove Duplicate Tests

You can simply remove duplicate tests with :

Expand Down

0 comments on commit 2a7a2b5

Please sign in to comment.