Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adding examples of flags #262

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 118 additions & 6 deletions versioned_docs/version-2.0.0/running-keploy/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ keywords:

Keploy CLI has the following <b> commands </b>:

- [Usage](#usage)
- [Common flags to use with all commands](#common-flags-to-use-with-all-commands)
- [Table of Contents](#table-of-contents)
- [Usage](#usage)
- [Common flags to use with all commands](#common-flags-to-use-with-all-commands)
- [record](#record)
- [test](#test)
- [generate-config](#generate-config)
Expand Down Expand Up @@ -44,15 +45,60 @@ keploy record [flags]
<b> Available flags: </b>

- `-c, --command string` - Command required to start the user application.

```bash
keploy record --command "node src/app.js"
```

In the command above, `node src/app.js` is the command which starts the user application.

- `--config-path string` - Path to the Keploy configuration file. The default is ".".

```bash
keploy record -c "node src/app.js" --config-path "./config-dir/"
```

In the above command, `config-dir` is the directory in the CWD where the Keploy configuration file `keploy-config.yaml` is stored.

- `--containerName string` - Name of the docker container in which the user application is running.
<!--
```bash
keploy record --containerName "my-app-container"
``` -->

- `-d, --delay uint` - Delay in seconds to run user application. The default is 5 seconds.

```bash
keploy record -c "node src/app.js" -d 10
```

- `- n, --networkName string` - Name of the docker network in which the user application is running.
<!--
```bash
keploy record --containerName "my-app-container" -n "my-app-network"
``` -->

- `--passThroughPorts uints` - Ports of outgoing dependency calls to be ignored as mocks and passed through to the actual dependency. The default is no ports.
- `-p, --path string` - Path to the local directory where the recorded testcases and generated mocks are to be saved.
- `--proxyport uint32` - Port to choose to run Keploy as a proxy.

```bash
keploy record -c "node src/app.js" -p "./tests"
```

In the above command, `tests` is the directory in the CWD where the recorded testcases and generated mocks are to be stored.

- `--proxyport uint32` - Port to choose to run Keploy as a proxy. The default is 16789.

```bash
keploy record -c "node src/app.js" --proxyport 8080
```

- `--debug` - To start recording testcases with debug mode enabled.

```bash
keploy record -c "node src/app.js" --debug
```

## [test](#test)

The `test` mode in Keploy allows the user to run the recoded testcases from the API calls and execute assertion. A detailed report is produced after the tests are executed and it's then saved in the yaml format in `keploy/reports` directory in the current working directory.
Expand All @@ -66,18 +112,78 @@ keploy test [flags]
<b> Available flags: </b>

- `--apiTimeout uint` - Timeout in seconds for calling user application. The default is 5 seconds.

```bash
keploy test -c "node src/app.js" --apiTimeout 10
```

- `-c, --command string` - Command required to start the user application.

```bash
keploy test -c "node src/app.js"
```

In the command above, `node src/app.js` is the command which starts the user application.

- `--config-path string` - Path to the Keploy configuration file. The default is ".".

```bash
keploy test -c "node src/app.js" --config-path "./config-dir/"
```

In the above command, `config-dir` is the directory in the CWD where the Keploy configuration file `keploy-config.yaml` is stored.

- `--containerName string` - Name of the docker container in which the user application is running.
<!--
```bash
keploy test --containerName "my-app-container"
``` -->

- `-d, --delay uint` - Delay in seconds to run user application. The default is 5 seconds.
- `--mongoPasswaord string` - Authentication password for mocking MongoDB connection. The default password is "default123".

```bash
keploy test -c "node src/app.js" --delay 10
```

- `--mongoPassword string` - Authentication password for mocking MongoDB connection. The default password is "default123".

```bash
keploy test -c "node src/app.js" --mongoPassword "my-password"
```

- `- n, --networkName string` - Name of the docker network in which the user application is running.
<!--
```bash
keploy test --containerName "my-app-container" -n "my-app-network" -d 9
``` -->

- `--passThroughPorts uints` - Ports of outgoing dependency calls to be ignored as mocks and passed through to the actual dependency. The default is no ports.
- `-p, --path string` - Path to the local directory where the recorded testcases and generated mocks are to be saved.
- `--proxyport uint32` - Port to choose to run Keploy as a proxy.
- `-p, --path string` - Path to the local directory where the recorded testcases and generated mocks are saved.

```bash
keploy test -c "node src/app.js" -d 10 --path "./tests"
```

In the above command, `tests` is the directory in the CWD where the recorded testcases and generated mocks are saved.

- `--proxyport uint32` - Port to choose to run Keploy as a proxy. The default is 16789.

```bash
keploy test -c "node src/app.js" --proxyport 8080
```

- `-t, --testsets strings` - To specify which specific testsets are to be executed. The default is all testsets.

```bash
keploy test -c "node src/app.js" -t "test-set-1,test-set-3" --delay 10
```

- `--debug` - To start executing testcases with debug mode enabled.

```bash
keploy test -c "node src/app.js" --delay 10 --debug
```

## [generate-config](#generate-config)

The `generate-config` command in Keploy is used to generate the Keploy Configuration File i.e. `keploy-config.yaml`. The generated configuration file is created in the current working directory.
Expand All @@ -91,3 +197,9 @@ keploy generate-config [flags]
<b> Available flags: </b>

- `-p, --path string` - Path to the local directory where the Keploy Configuration File will be stored. The default is ".".

```bash
keploy generate-config -p "./config-dir/"
```

In the above command, `config-dir` is the directory in the CWD where the Keploy configuration file `keploy-config.yaml` is to be stored.
Loading