From 30a9ce317db1a983d5e9f8fbb3a450139d4479a9 Mon Sep 17 00:00:00 2001 From: Shashwat79802 Date: Sat, 25 Nov 2023 14:43:49 +0530 Subject: [PATCH] chore: adding examples of flags Signed-off-by: Shashwat79802 --- .../running-keploy/cli-commands.md | 124 +++++++++++++++++- 1 file changed, 118 insertions(+), 6 deletions(-) diff --git a/versioned_docs/version-2.0.0/running-keploy/cli-commands.md b/versioned_docs/version-2.0.0/running-keploy/cli-commands.md index bd6f605a0..e954d06af 100755 --- a/versioned_docs/version-2.0.0/running-keploy/cli-commands.md +++ b/versioned_docs/version-2.0.0/running-keploy/cli-commands.md @@ -15,8 +15,9 @@ keywords: Keploy CLI has the following commands : -- [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) @@ -44,15 +45,60 @@ keploy record [flags] Available flags: - `-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. + + - `-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. + + - `--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. @@ -66,18 +112,78 @@ keploy test [flags] Available flags: - `--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. + + - `-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. + + - `--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. @@ -91,3 +197,9 @@ keploy generate-config [flags] Available flags: - `-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.