mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
docs(postman): Update documentation for postman tests (#2057)
This commit is contained in:
BIN
.github/secrets/connector_auth.toml.gpg
vendored
BIN
.github/secrets/connector_auth.toml.gpg
vendored
Binary file not shown.
@ -1,13 +1,49 @@
|
|||||||
# Test Runner
|
# Test Utils
|
||||||
|
|
||||||
The main part of running tests through `newman`.
|
The heart of `newman`(with directory support) and `UI-tests`
|
||||||
|
|
||||||
# Usage
|
## Newman Usage
|
||||||
|
|
||||||
- Make sure you that you've the postman collection for the connector available in the `postman` dir with the name `<connector_name>.postman_collection.json`
|
- Make sure you that you've _**do not**_ have the official newman installed but rather the `newman` fork with directory support
|
||||||
|
- `newman` can be installed by running `npm install -g 'https://github.com/knutties/newman.git#feature/newman-dir'`
|
||||||
|
- To see the features that the fork of `newman` supports, click [_**here**_](https://github.com/knutties/newman/blob/feature/newman-dir/DIR_COMMANDS.md)
|
||||||
- Add the connector credentials to the `connector_auth.toml` / `auth.toml`
|
- Add the connector credentials to the `connector_auth.toml` / `auth.toml`
|
||||||
- In terminal, execute:
|
- Export the auth file path as an environment variable:
|
||||||
```zsh
|
```shell
|
||||||
export CONNECTOR_AUTH_FILE_PATH=/path/to/auth.toml
|
export CONNECTOR_AUTH_FILE_PATH=/path/to/auth.toml
|
||||||
|
```
|
||||||
|
- Run the tests:
|
||||||
|
```shell
|
||||||
cargo run --package test_utils --bin test_utils -- --connector_name=<connector_name> --base_url=<base_url> --admin_api_key=<admin_api_key>
|
cargo run --package test_utils --bin test_utils -- --connector_name=<connector_name> --base_url=<base_url> --admin_api_key=<admin_api_key>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** You can optionally pass `--verbose` to see the logs of the tests. But make sure you that passing `--verbose` will also print the API-Keys in the logs. So, make sure you don't push the logs to any public repository. Below is an example:
|
||||||
|
```shell
|
||||||
|
cargo run --package test_utils --bin test_utils -- --connector_name=<connector_name> --base_url=<base_url> --admin_api_key=<admin_api_key> --verbose
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running newman locally
|
||||||
|
|
||||||
|
Execute the following commands:
|
||||||
|
```shell
|
||||||
|
export CONNECTOR_AUTH_FILE_PATH=/path/to/auth.toml
|
||||||
|
cargo run --package test_utils --bin test_utils -- --connector_name=<connector_name> --base_url=http://127.0.0.1:8080 --admin_api_key=test_admin
|
||||||
|
# Optionally, you can add `--verbose` in the end
|
||||||
|
```
|
||||||
|
## UI tests
|
||||||
|
|
||||||
|
To run the UI tests, run the following command:
|
||||||
|
```shell
|
||||||
|
cargo test --package test_utils --test connectors -- <connector_ui_name>::<optionally_name_of_specific_function_run> --test-threads=1
|
||||||
|
```
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Below is an example to run UI test to only run the `GooglePay` payment test for `adyen` connector:
|
||||||
|
```shell
|
||||||
|
cargo test --package test_utils --test connectors -- adyen_uk_ui::should_make_gpay_payment_test --test-threads=1
|
||||||
|
```
|
||||||
|
|
||||||
|
Below is an example to run all the UI tests for `adyen` connector:
|
||||||
|
```shell
|
||||||
|
cargo test --package test_utils --test connectors -- adyen_uk_ui:: --test-threads=1
|
||||||
|
```
|
||||||
@ -26,6 +26,9 @@ struct Args {
|
|||||||
/// Admin API Key of the environment
|
/// Admin API Key of the environment
|
||||||
#[arg(short, long = "admin_api_key")]
|
#[arg(short, long = "admin_api_key")]
|
||||||
admin_api_key: String,
|
admin_api_key: String,
|
||||||
|
/// Optional Verbose logs
|
||||||
|
#[arg(short, long)]
|
||||||
|
verbose: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -130,6 +133,10 @@ fn main() {
|
|||||||
|
|
||||||
newman_command.arg("--color").arg("on");
|
newman_command.arg("--color").arg("on");
|
||||||
|
|
||||||
|
if args.verbose {
|
||||||
|
newman_command.arg("--verbose");
|
||||||
|
}
|
||||||
|
|
||||||
// Execute the newman command
|
// Execute the newman command
|
||||||
let output = newman_command.spawn();
|
let output = newman_command.spawn();
|
||||||
let mut child = match output {
|
let mut child = match output {
|
||||||
|
|||||||
Reference in New Issue
Block a user