Skip to content

Commit

Permalink
docs(postman): update rustman and collection generation docs (#3615)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixincreate authored Feb 13, 2024
1 parent 09c2a5c commit 02652a2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 11 additions & 3 deletions crates/test_utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

The heart of `newman`(with directory support) and `UI-tests`

> If you're developing a collection and you want to learn more about it, click [_**here**_](/README.md)
> [!NOTE]
> If you're developing a collection and you want to learn more about it, click [_**here**_](/postman/README.md)
## Newman

Expand All @@ -14,10 +15,14 @@ The heart of `newman`(with directory support) and `UI-tests`

- Add the connector credentials to the `connector_auth.toml` / `auth.toml` by creating a copy of the `sample_auth.toml` from `router/tests/connectors/sample_auth.toml`
- Export the auth file path as an environment variable:

```shell
export CONNECTOR_AUTH_FILE_PATH=/path/to/auth.toml
```

> [!IMPORTANT]
> You might also need to export the `GATEWAY_MERCHANT_ID`, `GPAY_CERTIFICATE` and `GPAY_CERTIFICATE_KEYS` as environment variables for certain collections with necessary values. Make sure you do that before running the tests
### Supported Commands

Required fields:
Expand All @@ -40,18 +45,21 @@ Optional fields:
- Example: `--header "key1:value1" --header "key2:value2"`
- `--verbose` -- A boolean to print detailed logs (requests and responses)

**Note:** Passing `--verbose` will also print the connector as well as admin API keys in the logs. So, make sure you don't push the commands with `--verbose` to any public repository.
> [!Note]
> Passing `--verbose` will also print the connector as well as admin API keys in the logs. So, make sure you don't push the commands with `--verbose` to any public repository.
### Running tests

- Tests can be run with the following command:

```shell
cargo run --package test_utils --bin test_utils -- --connector-name=<connector_name> --base-url=<base_url> --admin-api-key=<admin_api_key> \
# optionally
--folder "<folder_name_1>,<folder_name_2>,...<folder_name_n>" --verbose
```

**Note**: You can omit `--package test_utils` at the time of running the above command since it is optional.
> [!Note]
> You can omit `--package test_utils` at the time of running the above command since it is optional.
## UI tests

Expand Down
7 changes: 4 additions & 3 deletions postman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ This directory contains the Postman collection for all Hyperswitch supported con

- Make sure that you update the `tests` section where the necessary `javascript` code has to written/updated to test the feature (assertion checks where you verify the results obtained with the expected outcome)
- If certain `tests` need to be run at the time of making a request, make sure you add them to the `Pre-request Script` section of the request
- Make sure that the request body does not contain any comments else the `newman dir-export` command will fail which is used to export the collection to its directory structure

---

- After all the development is done, make sure you right click and run the collection in respective environments to make sure that the collection runs successfully
- Export the collection as `v2.1` and save it `postman/collection-json` directory
- Export the postman-collection to its directory structure by using the command `newman dir-export /path/to/collection.json` and move the folder to `postman/collection-dir` (for more info, refer to [Newman-Fork](https://github.com/juspay/hyperswitch/tree/main/crates/test_utils#newman))
- You can run the dir postman collection from newman using `rustman` by referring [here](https://github.com/juspay/hyperswitch/tree/main/crates/test_utils#running-tests)
- Export the collection as `v2.1` and save it `postman/collection-json` directory with file name following the format `<connector_name>.postman_collection.json`
- Export the postman-collection to its directory structure by using the command `newman dir-export /path/to/collection.json` and move the folder to `postman/collection-dir` (for more info, refer to [Newman-Fork](/crates/test_utils/README.md#newman)) with the folder renamed with name of the connector
- You can run the postman collection from directory structure by referring [here](/crates/test_utils/README.md#running-tests)

0 comments on commit 02652a2

Please sign in to comment.