You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bruno CLI provides built-in support for generating reports in three formats: **JSON**, **JUnit**, and **HTML**. These reports help with analyzing test results and integrating with various CI/CD tools.
4
+
5
+
You can generate any combination of these reports and even run them simultaneously.
6
+
7
+
### JSON Report
8
+
9
+
To generate a report in JSON format, use the `--reporter-json` option:
10
+
11
+
```bash copy
12
+
bru run request.bru --reporter-json results.json
13
+
```
14
+
15
+
This will output the test results in a results.json file, which can be useful for further processing or programmatic analysis.
16
+
17
+
### JUnit Report
18
+
19
+
To generate a report in JUnit format, use the --reporter-junit option:
20
+
21
+
```bash copy
22
+
bru run request.bru --reporter-junit results.xml
23
+
```
24
+
25
+
The results.xml file will be in a format compatible with JUnit, making it ideal for integration with CI/CD pipelines that rely on JUnit reporting.
26
+
27
+
28
+
### HTML Report
29
+
30
+
To generate a human-readable HTML report, use the --reporter-html option:
31
+
32
+
```bash copy
33
+
bru run request.bru --reporter-html results.html
34
+
```
35
+
36
+
This will create an results.html file that provides a visual representation of the test outcomes, ideal for quick reviews.
37
+
38
+
### Running Multiple Reporters Simultaneously
39
+
40
+
You can generate multiple reports at once by specifying more than one reporter option. For example, to generate JSON, JUnit, and HTML reports simultaneously, run:
41
+
42
+
```bash copy
43
+
bru run request.bru --reporter-json results.json --reporter-junit results.xml --reporter-html results.html
44
+
```
45
+
46
+
This command will create three files: results.json, results.xml, and results.html, allowing you to analyze the results in different formats as needed.
Bruno CLI provides a variety of command options to help you customize your API testing and execution process. These options allow you to specify environments, configure reports, handle security, and much more. Below is a comprehensive list of available options:
5
+
6
+
## Bruno version
7
+
To check the current version of your Bruno CLI installation, use the following command:
8
+
9
+
```bash copy
10
+
bru --version
11
+
```
12
+
This will display the version number of the Bruno CLI you have installed. It's a helpful command for ensuring you're working with the latest version or for troubleshooting version-specific issues.
Copy file name to clipboardExpand all lines: src/pages/bru-cli/overview.mdx
+5-190Lines changed: 5 additions & 190 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,198 +4,13 @@ With Bruno CLI, you can run your API collections with ease using simple command
4
4
5
5
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.
6
6
7
-
## Installation
8
-
To install the Bruno CLI, use the node package manager of your choice, such as NPM:
9
-
```bash copy
10
-
npm install -g @usebruno/cli
11
-
```
12
7
13
-
## Getting Started
8
+
## Key Features of Bruno CLI:
14
9
15
-
Navigate to the directory where your API collection resides, and run the following command:
10
+
**1. Execute API Requests & Collections**: Run individual API requests or entire collections directly from the command line.
16
11
17
-
```bash copy
18
-
bru run
19
-
```
12
+
**2. Generate Test Reports** : Easily create reports in multiple formats, including JSON, JUnit, and HTML, to analyze and share test results.
20
13
21
-
This will run all the requests in your collection. If you want to run a single request, specify its filename:
14
+
**3. CI/CD Integration**: Effortlessly integrate with CI/CD pipelines for automated testing and validation.
22
15
23
-
```bash copy
24
-
bru run request.bru
25
-
```
26
-
27
-
## Running Requests in a Folder
28
-
To run all the requests within a folder, use:
29
-
30
-
```bash copy
31
-
bru run folder
32
-
```
33
-
34
-
## Using Environments
35
-
If you need to use a specific environment, you can pass it with the --env option:
36
-
37
-
```bash copy
38
-
bru run folder --env Local
39
-
```
40
-
41
-
## Passing Environment Variables
42
-
43
-
> Variables marked as secrets in Bruno app are not accessible via the CLI. Pass them directly as command-line arguments.
44
-
45
-
```bash copy
46
-
bru run folder --env Local --env-var JWT_TOKEN=1234
47
-
```
48
-
49
-
## Running a Collection with a CSV File
50
-
If you need to run a collection using data from a CSV file, specify the path to the file with the `--csv-file-path` option:
51
-
52
-
```bash copy
53
-
bru run folder --csv-file-path /path/to/csv/file.csv
54
-
```
55
-
56
-
## Running a Collection with a JSON File
57
-
To run a collection using data from a JSON file, provide the file path using the `--json-file-path` option:
58
-
59
-
```bash copy
60
-
bru run folder --json-file-path /path/to/json/file.json
61
-
```
62
-
> This feature requires Bruno CLI version 1.35.0 or higher.
63
-
64
-
65
-
## Outputting Results
66
-
To save the results of your API tests to a file, use the --output option:
67
-
68
-
```bash copy
69
-
bru run folder --output results.json
70
-
```
71
-
72
-
## Skipping Specific Headers in the Report
73
-
74
-
If you want to exclude certain headers from the report, use the `--reporter-skip-headers` option. You can list multiple headers to skip, separated by spaces.
75
-
76
-
```bash
77
-
bru run --reporter-html results.html --reporter-skip-headers "Authorization""Content-Type""Date"
78
-
```
79
-
80
-
## Skip All Headers in the Report
81
-
82
-
To exclude all headers from the report, use the `--reporter-skip-all-headers` option. This will remove all headers from the output report, ensuring a cleaner result.
83
-
84
-
```bash copy
85
-
bru run --reporter-html results.html --reporter-skip-all-headers
86
-
```
87
-
88
-
## Using Client Certificates for API Requests
89
-
90
-
If your API requests require client certificates for authentication, you can specify using the `--client-cert-config` option. The configuration should be provided in a JSON file. Here's an example of how to use this option:
91
-
92
-
```bash copy
93
-
bru run folder --client-cert-config /path/to/client-cert-config.json
94
-
```
95
-
96
-
The client-cert-config.json file should contain the following fields:
97
-
98
-
```json
99
-
{
100
-
"enabled": true,
101
-
"certs": [
102
-
{
103
-
"domain": "usebruno.com",
104
-
"type": "cert",
105
-
"certFilePath": "certs/server_1.crt",
106
-
"keyFilePath": "private/server_1.key",
107
-
"passphrase": "Iu$eBrun0_#Secure!"
108
-
},
109
-
{
110
-
"domain": "the-example.com",
111
-
"type": "pfx",
112
-
"pfxFilePath": "pfx/server_3.pfx",
113
-
"passphrase": "L!ghT_Y@g@mi_2024!"
114
-
}
115
-
]
116
-
}
117
-
```
118
-
## Adding Delay
119
-
If you need to add a delay between requests during the execution of your API collection, you can use the `--delay` option.
120
-
121
-
Example:
122
-
```bash copy
123
-
bru run . --delay 1000
124
-
```
125
-
## Generating Reports
126
-
127
-
Bruno CLI provides built-in support for generating reports in three formats: **JSON**, **JUnit**, and **HTML**. These reports help with analyzing test results and integrating with various CI/CD tools.
128
-
129
-
You can generate any combination of these reports and even run them simultaneously.
130
-
131
-
### JSON Report
132
-
133
-
To generate a report in JSON format, use the `--reporter-json` option:
134
-
135
-
```bash copy
136
-
bru run request.bru --reporter-json results.json
137
-
```
138
-
139
-
This will output the test results in a results.json file, which can be useful for further processing or programmatic analysis.
140
-
141
-
### JUnit Report
142
-
143
-
To generate a report in JUnit format, use the --reporter-junit option:
144
-
145
-
```bash copy
146
-
bru run request.bru --reporter-junit results.xml
147
-
```
148
-
149
-
The results.xml file will be in a format compatible with JUnit, making it ideal for integration with CI/CD pipelines that rely on JUnit reporting.
150
-
151
-
152
-
### HTML Report
153
-
154
-
To generate a human-readable HTML report, use the --reporter-html option:
155
-
156
-
```bash copy
157
-
bru run request.bru --reporter-html results.html
158
-
```
159
-
160
-
This will create an results.html file that provides a visual representation of the test outcomes, ideal for quick reviews.
161
-
162
-
### Running Multiple Reporters Simultaneously
163
-
164
-
You can generate multiple reports at once by specifying more than one reporter option. For example, to generate JSON, JUnit, and HTML reports simultaneously, run:
165
-
166
-
```bash copy
167
-
bru run request.bru --reporter-json results.json --reporter-junit results.xml --reporter-html results.html
168
-
```
169
-
170
-
This command will create three files: results.json, results.xml, and results.html, allowing you to analyze the results in different formats as needed.
0 commit comments