Problem
For example, the team has developed a new endpoint that is currently available only in the Test environment. It hasn't yet been deployed to the Stage or Live environments. Since we have a planned Live release, I've already prepared Bruno automation scripts for this new endpoint. However, because the endpoint is not present in the Live environment, these scripts are failing when executed in Stage and Live.
Solution
Tag-based script execution in Bruno is an ideal way to handle this situation. Bruno now supports executing scripts based on tags, allowing us to control which scripts run in which environments.
Let's walk through this scenario.
I assign tags to each script.
For the new endpoint scripts, I'll tag them with only 'Test'.
For all existing scripts, I'll tag them with 'Test', 'Stage', and 'Live'.
When running scripts in the Test environment, I'll pass the Test tag, so all scripts (including the new endpoint) will run.
However, when executing in the Live environment using the Live tag, Bruno will skip the new endpoint scripts, since those are tagged only for Test.
This approach ensures that test executions are accurate and environment-appropriate, avoiding failures due to undeployed features.
How to Add the Tags in Bruno?
We have multiple ways to add tags in Bruno scripts. One is from the Bruno UI (from the tool), and another is from the .bru file under the meta parameter.
Add tags from UI
To add tags from the Bruno UI tool, first expand your project and click on your API request.
After opening the API request details, click on the settings tab.
Then, you can see the "Tags" option. Type your tag and press enter. Then the given tag will be added.
![Tags option1-]()
You can also do the same for another API request.
When you add the tags, they will be added to the meta section for the selected request—Bru file.
![Tags2]()
Once you have added tags for all requests, you can run scripts based on the selection of a tag using the Bruno UI tool.
Before running the script, you must select the Tags and then run it.
When selecting the Run for Bruno collection, the UI will display the runner page. On this runner page, you can see two options with radio buttons: Filter requests by tags and Configure requests to run.
![Configure requests3]()
When you select "Filter request with tags," the application will display two additional options: "Include tags" and "Exclude tags."
When you click on the text box, the application displays the tag list; then, you can select a tag and press Enter.
![prompt4]()
![Run collection5]()
Then click on Run collection.
When you run the script using tags, you can see the tags during the run time, and on which tag the script is running.