Skip to content
On this page

JavaScript API Reference

Here is the complete set of API reference for the testing feature in Bruno.

Globals

Bruno currently has 6 globals that are available in your test script environment.

req

The request that was sent.
You can refer here for the complete set of APIs available for req

res

The response that was received.
You can refer here for the complete set of APIs available for res

bru

bru allows you to load inbuilt libraries as well as set and get environment variables.
You can refer here for the API for setting and getting environment variables and here to learn how to load inbuilt libraries.

test

The test method allows you to write assertions for your API behavior.

Example:

javascript
test("should be able to login", function() {
  const data = res.getBody();
  expect(res.getStatus()).to.equal(200);
});

expect

Bruno internally uses chaijs library to support bdd style expectations. You can refer the chaijs site for documentation for the expect API

assert

Bruno internally uses chaijs library to support bdd style assertions. You can refer the chaijs site for documentation for the assert API