Chappie is a test runner for Bruno collections. The Bruno CLI runner doesn't allow for custom response handlers, which is possible using Postman and Newman. Chappie solves this by parsing your Bruno collection and running the tests related to the responses. If the API returns an image, Chappie will use Sharp and Pixelmatch to either save the result or compare the result to an existing image.
- Concurrent requests
- Multiple iterations
- Test reports
- Image comparison
- JSON schema validation
- Bruno response tests
- Bruno variable support - Use
{{variable}}syntax andbru.setVar()/bru.getVar()
yarn add chappie-runner
NPM:
npm install chappie-runner
import { chappie } from "chappie-runner";
chappie.run({
collection: "./TestCollection.json", // the relative location of the collection
iterations: 1, // how many times to run the collection
concurrent: 1, // how many parallel runs there should be
actualImagesFolder: './actual-images', // where to store the image results
baseImagesFolder'./base-images', // where to store the base images
diffImagesFolder'./diff-images', // where to store the diff images (if they exist),
allowCodeExecution: false, // set to true if the collection is trusted
onTestError: error => {
console.log("on test error: ", error.message);
},
onRequestError: error => {
console.log("on request error: ", error.message);
},
onBeforeRequest: request => {
console.log("on before request: ", request.url);
},
onAfterRequest: response => {
console.log("on after request: ", response.type);
},
});
Chappie supports Bruno's comprehensive variable system with environment support:
Set and access variables during test execution:
- Set variables in tests using
bru.setVar(key, value) - Use variables in URLs, headers, and request bodies with
{{variableName}}syntax - Access variables in tests using
bru.getVar(key)
Define variables in Bruno collection environments:
{
"name": "API Collection",
"environments": [
{
"uid": "env-local",
"name": "Local Development",
"variables": [
{
"name": "baseUrl",
"value": "http://localhost:3001",
"enabled": true,
"secret": false
},
{
"name": "apiToken",
"value": "secret-token-123",
"enabled": true,
"secret": true
}
]
}
],
"activeEnvironmentUid": "env-local"
}Variables are resolved with the following priority:
- Runtime variables (set with
bru.setVar()) - highest priority - Environment variables (from collection environments) - lower priority
- If
activeEnvironmentUidis specified, that environment is used - If no active environment, the first environment is used by default
- If no environments exist, only runtime variables are available
Example Bruno Collection with Environment Variables:
{
"name": "Variable Example",
"items": [
{
"name": "Use Environment Variable",
"seq": 1,
"request": {
"url": "{{baseUrl}}/todos",
"method": "GET",
"headers": [
{
"name": "Authorization",
"value": "Bearer {{apiToken}}",
"enabled": true
}
],
"tests": "const response = res.getBody();\nif (Array.isArray(response) && response.length > 0) {\n bru.setVar('todoId', response[0].id);\n}"
}
},
{
"name": "Override with Runtime Variable",
"seq": 2,
"request": {
"url": "{{baseUrl}}/todos/{{todoId}}",
"method": "GET",
"tests": "test('Should use runtime variable', function() {\n expect(res.getStatus()).to.equal(200);\n expect(bru.getVar('todoId')).to.exist;\n});"
}
}
],
"environments": [
{
"uid": "env-local",
"name": "Local Development",
"variables": [
{
"name": "baseUrl",
"value": "http://localhost:3001",
"enabled": true
}
]
}
],
"activeEnvironmentUid": "env-local"
}Variable Features:
- Variables are automatically interpolated in URLs, headers, and request body values
- Runtime variables are scoped per iteration - they reset between iterations
- Environment variables persist across iterations and tests
- Secret masking: Variables with names containing 'secret', 'password', 'token', 'key', or 'auth' are automatically masked in logs
- Security note: Variable interpolation respects the
allowCodeExecutionsetting
Chappie also supports JUNIT tests.
chappie.run({
collection: "./TestCollection.json", // the relative location of the collection
reporter: {
enabled: true,
name: 'my-report-name',
output: './reports'
},
});
- ✅ Image comparison
- ✅ JSON validation
- ✅ Bruno variables and interpolation
- ⬜️ Auth and token support