|
| 1 | +# `respect` |
| 2 | + |
| 3 | +Use this command to execute API tests described in an Arazzo file. |
| 4 | +In addition to the Arazzo specification, `respect` supports specification extensions for API testing: `x-operation` and `x-serverUrl`. |
| 5 | + |
| 6 | +## Usage |
| 7 | + |
| 8 | +```sh |
| 9 | +npx @redocly/cli respect <your-test-file | multiple files | files bash query> [-w | --workflow] [-s | --skip] [-v | --verbose] [-i | --input] |
| 10 | +``` |
| 11 | + |
| 12 | +## Options |
| 13 | + |
| 14 | +{% table %} |
| 15 | +* Option {% width="20%" %} |
| 16 | +* Type {% width="15%" %} |
| 17 | +* Description |
| 18 | +--- |
| 19 | +* -w, --workflow |
| 20 | +* [string] |
| 21 | +* Workflow names from the test file to run. |
| 22 | + For example, the following command runs "first-flow" and "second-flow" workflows from the "test-file.yaml" test file: `npx @redocly/cli respect test-file.yaml --workflow first-flow second-flow` |
| 23 | + {% admonition type="warning" %} |
| 24 | + The `--workflow` option can't be used with `--skip`. |
| 25 | + {% /admonition %} |
| 26 | +--- |
| 27 | +* -s, --skip |
| 28 | +* [string] |
| 29 | +* Workflow names from the test file to skip. |
| 30 | + For example, the following command skips the "first-flow" workflow from the "test-file.yaml" test file: `npx @redocly/cli respect test-file.yaml --skip first-flow` |
| 31 | + {% admonition type="warning" %} |
| 32 | + Warning: the `--skip` option can't be used with `--workflow`. |
| 33 | + {% /admonition %} |
| 34 | +--- |
| 35 | +* -v, --verbose |
| 36 | +* boolean |
| 37 | +* Runs the command in verbose mode to help with troubleshooting issues. |
| 38 | + For example, the following command runs all workflows from the "test-file.yaml" test file in verbose mode: `npx @redocly/cli respect test-file.yaml --verbose` |
| 39 | +--- |
| 40 | +* --har-output |
| 41 | +* string |
| 42 | +* Path for the `har` file for saving logs. |
| 43 | + For example, the following command runs all workflows from the "test-file.yaml" test file and saves the logs to the "logs.har" file: `npx @redocly/cli respect test-file.yaml --har-output='logs.har'` |
| 44 | +--- |
| 45 | +* --json-output |
| 46 | +* string |
| 47 | +* Path for the 'json` file for saving logs. |
| 48 | + For example, the following command runs all workflows from the "test-file.yaml" test file and saves the logs to the "logs.json" file: `npx @redocly/cli respect test-file.yaml --json-output='logs.json'` |
| 49 | +--- |
| 50 | +* --input |
| 51 | +* string |
| 52 | +* Input parameters with values that are mapped to the workflow inputs description. |
| 53 | + For example, the following command maps the "userEmail" and "userPassword" inputs and values to all workflows in the "test.yaml" test file: `npx @redocly/cli respect test.yaml --input [email protected] --input userPassword=12345`. |
| 54 | + You can also use an environment variable to set the input, as in the following example: `REDOCLY_CLI_RESPECT_INPUT='[email protected],userPassword=12345' npm run cli respect test.yaml` |
| 55 | + |
| 56 | + You can even include nested values, as in the following example command that maps the "nestedKey" input and value to all workflows in the "test-file.yaml" test file: `npx @redocly/cli respect test-file.yaml --input '{"key": "value", "nested": {"nestedKey": "nestedValue"}}'`. |
| 57 | + You can also use an environment variable to set the input, as in the following example: `REDOCLY_CLI_RESPECT_INPUT='{"key":"value","nested":{"nestedKey":"nestedValue"}}' npx @redocly/cli respect test-file.yaml` |
| 58 | +--- |
| 59 | +* --server |
| 60 | +* string |
| 61 | +* Server overrides for the `sourceDescriptions` object. |
| 62 | + For example, the following command runs all workflows from the "test-file.yaml" test file and instead of using the server listed in the API description, uses the server at "https://test.com": `npx @redocly/cli respect test-file.yaml --server test=https://test.com` |
| 63 | + |
| 64 | + You can also pass the server overrides as an environment variable, as in the following example: |
| 65 | + `REDOCLY_CLI_RESPECT_SERVER="test=https://test.com"` |
| 66 | +--- |
| 67 | +* --residency |
| 68 | +* string |
| 69 | +* Residency location of Reunite application to use if `login` command was not run before. |
| 70 | + Default: `us`. |
| 71 | + You can also pass the residency as an environment variable, as in the following example: |
| 72 | + `REDOCLY_CLI_RESPECT_RESIDENCY='eu'` |
| 73 | +{% /table %} |
| 74 | + |
| 75 | +## Examples |
| 76 | + |
| 77 | +- Run the tests by running the following command: `npx @redocly/cli respect <your-test-file>`. |
| 78 | +- Run multiple tests by running the following command: `npx @redocly/cli respect <your-test-file-one> <your-test-file-two>`. |
| 79 | +- Run multiple tests by running the following command with bash selector : `npx @redocly/cli respect $(find ./path-to-tests-folder -type f -name '*.arazzo.yaml')`. |
| 80 | + |
| 81 | +**Example output** |
| 82 | + |
| 83 | +```bash |
| 84 | +Running workflow warp.arazzo.yaml / missionLostInvention |
| 85 | + |
| 86 | + ✓ POST /anchors - step setAnchorToCurrentTime |
| 87 | + ✓ status code check (Response code 201 matches one of description codes: [201, 409]) |
| 88 | + ✓ content-type check |
| 89 | + ✓ schema check |
| 90 | + |
| 91 | + ✓ POST /timelines - step createTimelineTo1889 |
| 92 | + ✓ status code check (Response code 201 matches one of description codes: [201]) |
| 93 | + ✓ content-type check |
| 94 | + ✓ schema check |
| 95 | + |
| 96 | + ✓ POST /travels - step travelTo1889 |
| 97 | + ✓ status code check (Response code 200 matches one of description codes: [200, 400]) |
| 98 | + ✓ content-type check |
| 99 | + ✓ schema check |
| 100 | + |
| 101 | + ✓ POST /items - step findAndRegisterBlueprint |
| 102 | + ✓ status code check (Response code 200 matches one of description codes: [200, 409]) |
| 103 | + ✓ content-type check |
| 104 | + ✓ schema check |
| 105 | + |
| 106 | + ✓ POST /paradox-checks - step avoidParadox |
| 107 | + ✓ success criteria check |
| 108 | + ✓ success criteria check |
| 109 | + ✓ status code check (Response code 200 matches one of description codes: [200, 400]) |
| 110 | + ✓ content-type check |
| 111 | + ✓ schema check |
| 112 | + |
| 113 | + ✓ POST /travels - step returnToPresent |
| 114 | + ✓ status code check (Response code 200 matches one of description codes: [200, 400]) |
| 115 | + ✓ content-type check |
| 116 | + ✓ schema check |
| 117 | + |
| 118 | + |
| 119 | + Summary for warp.arazzo.yaml |
| 120 | + |
| 121 | + Workflows: 1 passed, 1 total |
| 122 | + Steps: 6 passed, 6 total |
| 123 | + Checks: 20 passed, 20 total |
| 124 | + Time: 1060ms |
| 125 | + |
| 126 | + |
| 127 | +┌──────────────────────────────────────────────────────────┬────────────┬─────────┬─────────┬──────────┬─────────┐ |
| 128 | +│ Filename │ Workflows │ Passed │ Failed │ Warnings │ Skipped │ |
| 129 | +├──────────────────────────────────────────────────────────┼────────────┼─────────┼─────────┼──────────┼─────────┤ |
| 130 | +│ ✓ warp.arazzo.yaml │ 1 │ 1 │ - │ - │ - │ |
| 131 | +└──────────────────────────────────────────────────────────┴────────────┴─────────┴─────────┴──────────┴─────────┘ |
| 132 | +``` |
| 133 | + |
| 134 | +<!-- UNCOMMENT AFTER OTHER CONTENT PUBLISHES AND CHECK RELATIVE LINKS |
| 135 | +## Resources |
| 136 | +
|
| 137 | +- Learn more about using mTLS with Respect in [Use mTLS](../../respect/guides/mtls-cli.md). |
| 138 | +- Follow steps to test API sequences in [Test a sequence of API calls](../../respect/guides/test-api-sequences.md). |
| 139 | +- Learn what Respect is and how you can use it to test API in the [Respect](../../respect/index.md) concept document. |
| 140 | +- Link to learning center for Arazzo too |
| 141 | +--> |
0 commit comments