Linux command
bru 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run a single API request
bru run [request.bru]
Run all requests
bru run [folder/]
Run with a specific environment
bru run [folder/] --env [production]
Run with environment variables
bru run [request.bru] --env-var [API_KEY=secret]
Generate JSON, JUnit, and HTML reports
bru run [folder/] --reporter-json [results.json] --reporter-junit [results.xml] --reporter-html [results.html]
Import an OpenAPI spec
bru import openapi --source [api.yml] --output [~/collections] --collection-name [MyAPI]
Run and stop on first failure
bru run [folder/] --env [staging] --bail
Run with custom CA certificate
bru run [request.bru] --cacert [/path/to/ca.crt]
说明
bru is the command-line interface for Bruno, an open-source API client similar to Postman or Insomnia. Bruno stores API collections directly in the filesystem using plain text .bru files, making them version-control friendly. The CLI enables headless execution of API requests for CI/CD pipelines, automated testing, and scripted operations. Collections can be stored alongside code repositories for easy collaboration.
参数
- --env _name_
- Use a specific environment for the run.
- --env-var _key=value_
- Set environment variables for the run.
- --reporter-json _file_
- Output results in JSON format.
- --reporter-junit _file_
- Output results in JUnit XML format.
- --reporter-html _file_
- Output results in HTML format.
- --cacert _path_
- Path to a CA certificate file for HTTPS requests.
- --insecure
- Skip SSL certificate verification.
- -r, --recursive
- Recursively run requests in subfolders.
- --bail
- Stop execution after a failed request, test, or assertion.
- --sandbox _mode_
- JavaScript execution mode: safe (default) or developer.
- --parallel
- Run requests in parallel instead of sequentially.
- --delay _ms_
- Delay between requests in milliseconds.
- --tests-only
- Execute only requests containing tests or active assertions.
- --csv-file-path _file_
- Run collection once for each row in a CSV file.
- --env-file _file_
- Path to an environment file (.bru or .json).
FAQ
What is the bru command used for?
bru is the command-line interface for Bruno, an open-source API client similar to Postman or Insomnia. Bruno stores API collections directly in the filesystem using plain text .bru files, making them version-control friendly. The CLI enables headless execution of API requests for CI/CD pipelines, automated testing, and scripted operations. Collections can be stored alongside code repositories for easy collaboration.
How do I run a basic bru example?
Run `bru run [request.bru]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --env _name_ do in bru?
Use a specific environment for the run.