Skip to content

Commit 3bf6aa1

Browse files
authored
Update contribution guide (#725)
* chore: update contribution guide Signed-off-by: Achanandhi-M <achanandhi.m@gmail.com> * chore: update contribution guide Signed-off-by: Achanandhi-M <achanandhi.m@gmail.com> --------- Signed-off-by: Achanandhi-M <achanandhi.m@gmail.com>
1 parent 7d4787c commit 3bf6aa1

File tree

3 files changed

+48
-96
lines changed

3 files changed

+48
-96
lines changed

versioned_docs/version-3.0.0/keploy-explained/dev-guide.md

Lines changed: 30 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ tags:
1010

1111
# Contribution Guide 🚀
1212

13-
Welcome to the world of Keploy development! Here, we'll get you up and running smoothly, making your Keploy journey a breeze.
13+
Welcome to the world of Keploy development! This guide will help you set up Keploy locally.
1414

1515
### 1. **Setting Up Your Platform**:
1616

17-
Running Keploy on macOS or Windows? No problem! You'll need to create a Linux VM.
17+
_If you want to try Keploy on macOS or Windows, no worries — you’ll just need to set up a Linux VM._
1818

1919
- For macOS, install [Lima](https://github.com/lima-vm/lima#installation).
2020
- If you're on Windows, install [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
@@ -25,28 +25,37 @@ Note: Linux Users are good to go.
2525

2626
First things first, ensure you have [Golang](https://go.dev/doc/install) installed.
2727

28-
### 3. **Cloning Keploy Repository**:
28+
### 3. **Clone Keploy Repository**:
2929

30-
Time to get your hands on Keploy! Run these commands to clone the repository and download those Go dependencies:
30+
Time to get your hands on Keploy!:
3131

3232
```shell
3333
git clone https://github.com/keploy/keploy.git && cd keploy
3434
go mod download
3535
```
3636

37-
### 4. Running Keploy on v2:
37+
Once done, build the binary
3838

39-
The Keploy CLI operates by capturing all network traffic between your application and its dependencies.
40-
It meticulously records API calls, database queries, and any other interactions your application engages in.
39+
```shell
40+
go build -race -tags=viper_bind_struct -o keploy .
41+
sudo mv keploy /usr/local/bin/
42+
sudo chmod +x /usr/local/bin/keploy
43+
```
4144

42-
Once the recording phase is complete, Keploy can effortlessly generate test cases and data mocks in YAML format.
45+
**_Now we have successfully set up Keploy. Let’s test it with the sample app._**
4346

4447
#### Keploy operates in two modes:
4548

4649
- `record`: Capture Keploy test cases from API calls.
4750
- `test`: Execute recorded test cases and validate assertions.
4851

49-
To dive into Keploy, you can use the [gin-mongo URL Shortener](https://github.com/keploy/samples-go/tree/main/gin-mongo) sample application:
52+
The Keploy CLI operates by capturing all network traffic between your application and its dependencies.
53+
54+
It meticulously records API calls, database queries, and any other interactions your application engages in.
55+
56+
Once the recording phase is complete, Keploy can effortlessly generate test cases and data mocks in YAML format.
57+
58+
If you don't have any samples app, you can use the [gin-mongo URL Shortener](https://github.com/keploy/samples-go/tree/main/gin-mongo) sample application:
5059

5160
#### Let's clone sample app repo:
5261

@@ -56,110 +65,50 @@ go mod download # Download dependencies:
5665
go build -o gin-mongo-binary # Generate binary of the application:
5766
```
5867

59-
### Now let's try running keploy:
60-
61-
#### Capturing Test Cases:
62-
63-
```shell
64-
go run -exec "sudo -E env 'PATH=$PATH'" -tags=viper_bind_struct main.go record -c "path/to/go/binary/of/application"
65-
```
66-
67-
After entering record mode, send requests to your application to generate test cases.
68-
69-
#### Running Test Cases:
70-
71-
```shell
72-
go run -exec "sudo -E env 'PATH=$PATH'" -tags=viper_bind_struct main.go test -c "path/to/go/binary/of/application" --delay 10
73-
```
74-
75-
Run Keploy server to expose test APIs:
76-
77-
```shell
78-
go run -exec "sudo -E env 'PATH=$PATH'" -tags=viper_bind_struct main.go test -c "path/to/go/binary/of/application" --delay 10 --coverage
79-
```
80-
81-
Generated test cases can be found inside the Keploy directory.
82-
83-
### 5. Setup Keploy using Binary:
84-
85-
#### Generate Keploy Binary:
86-
87-
```shell
88-
go build -race -tags=viper_bind_struct -o keploy . && sudo mv keploy /usr/local/bin
89-
```
68+
### 4. Now let's try running keploy:
9069

9170
#### Capturing Test Cases:
9271

9372
```shell
94-
sudo -E env PATH="$PATH" keploy record -c "path/to/go/binary"
73+
sudo keploy record -c "path/to/go/binary"
9574
```
9675

9776
#### Running Test Cases:
9877

9978
```shell
100-
sudo -E env PATH="$PATH" keploy test -c "path/to/go/binary" --delay 10
79+
sudo keploy test -c "path/to/go/binary" --delay 10
10180
```
10281

10382
Note: Use the `--debug` flag to run Keploy in debug mode for detailed logs.
10483

105-
### 6. Setup Keploy via Docker:
106-
107-
#### Install the Keploy Docker Image:
108-
109-
```shell
110-
docker pull ghcr.io/keploy/keploy
111-
```
112-
113-
#### Create Keploy Alias:
114-
115-
```shell
116-
alias keployV2='sudo docker run --pull always --name keploy-v2 -p 16789:16789 --network keploy-network --privileged --pid=host -it -v $(pwd):$(pwd) -w $(pwd) -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/keploy/keploy'
117-
```
118-
119-
#### Capture Test Cases:
120-
121-
```shell
122-
keployV2 record -c "docker run -p 8080:8080 --name <containerName> --network keploy-network --rm <imageName>"" --containerName <containerName>
123-
```
124-
125-
#### Running Test Cases:
126-
127-
```shell
128-
keployV2 test --c "docker run -p 8080:8080 --name <containerName> --network keploy-network --rm <imageName>" --delay 10
129-
```
130-
131-
### 7. Testing Locally Built Docker Image:
84+
### Also you can Test Locally Built Docker Image:
13285

13386
#### Build Docker Image:
13487

135-
Run the below command inside the keploy respository and make sure there is no directory by the name of keploy inside the main keploy repository.
88+
Note: Run the below command inside the keploy respository and make sure there is no directory by the name of keploy inside the main keploy repository.
13689

13790
```shell
13891
sudo docker image build -t ghcr.io/keploy/keploy:v2-dev .
13992
```
14093

141-
#### Create Alias:
142-
143-
```shell
144-
alias keployV2='sudo docker run --name keploy-v2 -p 16789:16789 --privileged --pid=host -it -v $(pwd):$(pwd) -w $(pwd) -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock -v '"$HOME"'/.keploy-config:/root/.keploy-config -v '"$HOME"'/.keploy:/root/.keploy --rm ghcr.io/keploy/keploy:v2-dev'
145-
```
146-
147-
#### Remember setting up the Keploy binary. See [Setup Keploy using Binary](#5-setup-keploy-using-binary) for details.
94+
#### Remember setting up the Keploy binary. See [Setup Keploy using Binary](#3-clone-keploy-repository) for details.
14895

14996
#### Capture Test Cases:
15097

15198
```shell
152-
sudo -E env PATH="$PATH" keployV2 record -c "docker run -p 8080:8080 --name <containerName> --network keploy-network --rm <imageName>"" --containerName <containerName>
99+
sudo keploy record -c "docker run -p -p <appPort>:<hostPort> --name <containerName> --network keploy-network --rm <imageName>"
153100
```
154101

155102
#### Running Test Cases:
156103

157104
```shell
158-
sudo -E env PATH="$PATH" keployV2 test --c "docker run -p 8080:8080 --name <containerName> --network keploy-network --rm <imageName>" --delay 10
105+
sudo keploy test -c "docker run -p -p <appPort>:<hostPort> --name <containerName> --network keploy-network --rm <imageName>" --delay 10
159106
```
160107

161-
There you have it! With this guide, you're all set to dive into Keploy development. Happy testing! 🧪🔍💻
108+
There you have it! With this guide, you're all set to dive into Keploy development.
109+
110+
Happy testing! 🧪🔍💻
162111

163112
> **Note** :- Run `go run github.com/99designs/gqlgen generate --config pkg/graph/gqlgen.yml` to generate the graphql server stubs which can be used when working with unit testing libraries like JUnit, PyTest, etc..
164113
165-
Hope this helps you out, if you still have any questions, reach out to us .
114+
Hope this helps you out, if you still have any questions, reach out to us on [slack](https://keploy.slack.com/join/shared_invite/zt-357qqm9b5-PbZRVu3Yt2rJIa6ofrwWNg) .

versioned_docs/version-3.0.0/keploy-explained/docs-dev-guide.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
11
---
22
id: docs-dev-guide
3-
title: docs-dev-guide
3+
title: Keploy Docs Contribution Guide
44
sidebar_label: Docs Dev Guide
55
tags:
66
- dev guide
77
- explanation
88
- contributing
99
---
1010

11-
# How to contribute
11+
We welcome and appreciate contributions from the community. There are several ways you can help improve the documentation:
1212

13-
We encourage contributions from the community.
13+
### Ways to Contribute:
1414

15-
**Create a [GitHub issue](https://github.com/keploy/docs/issues) for any changes beyond typos and small fixes.**
15+
**1. Code Contribution**.
1616

17-
If you do create a pull request (PR), please follow our style guidance.
17+
**2. Report bugs or suggest improvements**.
1818

19-
We review GitHub issues and PRs on a regular schedule.
19+
**3. Suggest UI/UX enhancements**.
20+
21+
**4. Contribute to translations**.
22+
23+
Your contributions help strengthen the documentation and support the Keploy community
24+
25+
**Note: Create a [GitHub issue](https://github.com/keploy/keploy/issues/new/choose) for any changes beyond typos and small fixes.**
26+
27+
If you do create a pull request (PR) or Github issues, please follow our style guidance.
2028

21-
To ensure that each change is relevant and properly peer reviewed, please adhere to best practices for open-source contributions.
22-
This means that if you are outside the Keploy organization, you must fork the repository and create PRs from branches on your own fork.
2329
The README in GitHub's [first-contributions repo](https://github.com/firstcontributions/first-contributions) provides an example.
2430

2531
## How to set up the docs website locally?
2632

27-
The Keploy documentation site uses Docusaurus 2 which is a static website generator.
33+
The Keploy documentation site uses Docusaurus which is a static website generator.
2834

2935
You can make changes locally without previewing them in the browser.
30-
However, if you want to build the site and preview changes in the browser, you need to have Docusaurus 2 dependencies installed.
36+
However, if you want to build the site and preview changes in the browser, you need to have Docusaurus dependencies installed.
3137

32-
Initialize Docusaurus 2 in the repo by running [`yarn`](https://classic.yarnpkg.com/en/docs/cli/) or [`npm`](https://docs.npmjs.com/cli/v10) once in the root directory of the repo.
38+
Initialize Docusaurus in the repo by running [`yarn`](https://classic.yarnpkg.com/en/docs/cli/) or [`npm`](https://docs.npmjs.com/cli/v10) once in the root directory of the repo.
3339

3440
Now you can build and view the site locally:
3541

versioned_sidebars/version-3.0.0-sidebars.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,7 @@
245245
"collapsible": true,
246246
"items": [
247247
"keploy-explained/contribution-guide",
248-
"keploy-explained/docs-dev-guide",
249-
"keploy-explained/debugger-guide",
250-
"keploy-explained/testing-guide",
251-
"keploy-explained/mac-linux"
248+
"keploy-explained/docs-dev-guide"
252249
]
253250
}
254251
]

0 commit comments

Comments
 (0)