2023-02-07 23:15:27 +01:00
# bruno-cli
2023-04-01 10:10:23 +02:00
With Bruno CLI, you can now run your API collections with ease using simple command line commands.
2023-02-07 23:15:27 +01:00
2023-04-01 10:10:23 +02:00
This makes it easier to test your APIs in different environments, automate your testing process, and integrate your API tests with your continuous integration and deployment workflows.
## Installation
2023-09-25 23:48:53 +02:00
2023-04-01 10:10:23 +02:00
To install the Bruno CLI, use the node package manager of your choice, such as NPM:
2023-09-25 23:48:53 +02:00
2023-04-01 10:10:23 +02:00
```bash
npm install -g @usebruno/cli
```
## Getting started
2023-09-25 23:48:53 +02:00
2023-04-01 10:10:23 +02:00
Navigate to the directory where your API collection resides, and then run:
2023-09-25 23:48:53 +02:00
2023-04-01 10:10:23 +02:00
```bash
2023-04-01 10:25:32 +02:00
bru run
2023-04-01 10:10:23 +02:00
```
2023-09-25 23:48:53 +02:00
2023-04-01 10:10:23 +02:00
This command will run all the requests in your collection. You can also run a single request by specifying its filename:
```bash
2023-04-01 10:25:32 +02:00
bru run request.bru
2023-04-01 10:10:23 +02:00
```
2023-08-29 11:36:35 +02:00
Or run all requests in a collection's subfolder:
2023-09-25 23:48:53 +02:00
2023-02-07 23:15:27 +01:00
```bash
2023-04-01 10:25:32 +02:00
bru run folder
2023-04-01 10:10:23 +02:00
```
2024-06-17 12:58:39 +02:00
If you need to use an environment, you can specify it with the `--env` option:
2023-09-25 23:48:53 +02:00
2023-04-01 10:10:23 +02:00
```bash
2023-04-01 10:25:32 +02:00
bru run folder --env Local
2023-04-01 10:10:23 +02:00
```
2024-06-17 12:58:39 +02:00
If you need to collect the results of your API tests, you can specify the `--output` option:
2023-09-25 23:48:53 +02:00
```bash
bru run folder --output results.json
```
2024-06-17 12:58:39 +02:00
If you need to run a set of requests that connect to peers with both publicly and privately signed certificates respectively, you can add private CA certificates via the `--cacert` option. By default, these certificates will be used in addition to the default truststore:
```bash
bru run folder --cacert myCustomCA.pem
```
If you need to limit the trusted CA to a specified set when validating the request peer, provide them via `--cacert` and in addition use `--ignore-truststore` to disable the default truststore:
```bash
bru run request.bru --cacert myCustomCA.pem --ignore-truststore
```
2024-06-05 16:59:59 +02:00
## Scripting
Bruno cli returns the following exit status codes:
- `0` -- execution successful
- `1` -- an assertion, test, or request in the executed collection failed
- `2` -- the specified output directory does not exist
- `3` -- the request chain seems to loop endlessly
2024-07-10 07:59:23 +02:00
- `4` -- bru was called outside of a collection root directory
2024-06-05 16:59:59 +02:00
- `5` -- the specified input file does not exist
- `6` -- the specified environment does not exist
- `7` -- the environment override was not a string or object
- `8` -- an environment override is malformed
- `9` -- an invalid output format was requested
2024-07-10 07:59:23 +02:00
- `255` -- another error occurred
2024-06-05 16:59:59 +02:00
2023-04-01 10:16:13 +02:00
## Demo
2023-09-25 23:48:53 +02:00
2023-04-01 10:27:59 +02:00
![demo ](assets/images/cli-demo.png )
2023-04-01 10:16:13 +02:00
2023-04-01 10:10:23 +02:00
## Support
2023-09-25 23:48:53 +02:00
2023-04-01 10:10:23 +02:00
If you encounter any issues or have any feedback or suggestions, please raise them on our [GitHub repository ](https://github.com/usebruno/bruno )
Thank you for using Bruno CLI!
2023-09-04 08:54:18 +02:00
## Changelog
2023-09-25 23:48:53 +02:00
2024-03-11 13:16:14 +01:00
<!-- An absolute link is used here because npm treats links differently -->
2024-06-05 16:59:59 +02:00
2024-03-12 18:47:47 +01:00
See [https://github.com/usebruno/bruno/releases ](https://github.com/usebruno/bruno/releases )
2023-04-01 10:10:23 +02:00
## License
2023-09-25 23:48:53 +02:00
[MIT ](license.md )