Bruno: First thoughts
Tags: api, bruno, testing
Published: 2023-12-24 06:56:34

Bruno is an open-source, free API testing client. This post contains my initial thoughts from the first time giving it a quick test run to try out the features. 

I've been a long-time user of Postman, and as they continue to push the monetisation of their product, I've been interested in an alternative. When the ChangeLog mentioned Bruno, I was excited to try it out.

> TLDR: I like it, and I'm keen to go deeper on what it can offer. 

## Project health 
The project looks to be healthy, the website lists 2 core contributors with over 100 contributors overall. 
Github shows the last commit to the `main` branch was yesterday (at the time of writing this).  
That reinforces my thoughts that this project is not going anywhere and is something that is worth looking into. 

## Setup
The website [usebruno.com](https://usebruno.com) is simple and modern and gives off vibes of a project that is more than just a side thought.

![The Bruo website initial page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jd7r4w8gjo4rs7jeq802.png)

Downloading and installing on my Mac was straightforward. The website also lists how to set it up using Home Brew which I thought was a nice touch. 

## The GUI 

The GUI is pretty standard for API clients, which makes the learning curve low for me. 
![The Bruno GUI with no open tabs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jy2wuewhu99lzwx2yhd.png)

I was quickly able to create a collection and add requests to it without having to consult the documentation. Tests are grouped into collections in the left-hand pane. Colours are used to denote different types of requests. 


![Bruno GUI with multiple requests](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6chk6fzl2coktbuhi9s4.png)

Ease of use fell down when I wanted to add some assertions to verify that the response I was getting was what I expected. The good news is that a quick trip to the documentation site [docs.usebruno.com](https://docs.usebruno.com/) was able to help me out, using by editing the file, which I could then see in the UI. 

## The File 

This is where Bruno claims its main strength. Rather than being saved away in a proprietary file, somewhere requests are saved in a plain text, human-readable file ❤️❤️❤️❤️❤️. 
This is fantastic. For developers like me, editing text files feels like home. Changes made to the file are picked up by the GUI instantly so I was able to seamlessly switch from editing the file to editing the request in the GUI. 

The fact that I can store these in my git repository alongside my API has me ecstatic. I used to do this with Postman collections; the issue there was that the whole collection was stored in a single file, making it nigh on impossible to track changes, hand edit the file, and any changes made by another team member meant that I had to be announced so people could reload the collection *. 

## The CLI 

Something that excites me about the idea of having requests saved in a file alongside the application is that I can use these requests as living documentation when changes are made. As part of Continuous Integration, the API can be spun up, and the collection of requests can be executed against the API. This ensures that the collection is still documenting valid requests. 

Trying out the CLI, I ran into a couple of problems. The documentation asks me to use NPM to install it globally. Because I want to run this in CI, I'd prefer not to do that as I'd like to have the version of the CLI documented in the `package.json`. I installed it as a dev dependency and used Yarn to run it from the local `node_modules` folder. This gave me a working version of the CLI. 

```json
"scripts: {
    "bruno": "bru"
}
```

Running my yarn script and pointing at a file in my collection directory gave me an error: `You can run only at the root of a collection.` This was a bit disappointing, but adding `cd ./sample-requests/` to the start of the command fixed it. 


## Final thoughts 

For now that's as far as I've gone with Bruno. I know I've just touched the surface of what Bruno has to offer. Already, it's left me excited! I am already planning to make it my default API client. 

I'm excited to go further with the testing and scripting parts of the request life cycle and see how to integrate it with CI systems. 

## PS
I love that they have this good boi as the mascot and chief joy officer. 
![The Bruno about page which shows that Bruno is the name of the authors dog. Bruno the dog looks so happy.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhmxno98ahxypk4iobh6.png)



 * This makes sense, as sharing and change tracking were part of the Postman paid offering.