Bruno Test Data: Seeded JSON Data Files for Bruno and Insomnia
Bruno test data tends to start as a JSON or CSV file with three hand-typed
rows, all happy-path. Negative cases end up as extra .bru requests with
hard-coded bodies. When a CI run fails, nobody can say which values broke
it. This post replaces that file with one generated from a template and a
fixed seed. Each row carries the status code it should produce: valid
customers, planted invalid ones, exact age boundaries, a duplicate email.
The file is committed next to the collection, runs with bru run locally
and in CI, and also runs unchanged in Insomnia and its Inso CLI.
JsonFabrica's part is small. It's a JSON-over-HTTP API that renders the template. A short shell script calls it with curl and writes the result into the repository. There's no Bruno or Insomnia plugin. Both tools just read a JSON file from disk, and neither one ever calls JsonFabrica.
What I actually ran: Bru CLI 4.4.0 from npm and Inso CLI 13.5.0 (the Linux release binary), both on Linux, against a throwaway Node.js customers API written for this post. The data files were rendered with the JsonFabrica template engine through a local stand-in for the generate endpoint. I didn't call the hosted API, and I didn't run the GitHub Actions workflows or the Bruno or Insomnia desktop apps. All command output below comes from those runs, trimmed where noted.
How Bruno test data files work: CSV and JSON
Bruno's Collection Runner can iterate over a data file. It runs the
collection once per row, and each row's keys become variables for that
iteration. Two flags on bru run do this:
--json-file-path data.jsontakes an array of objects, one object per iteration.--csv-file-path data.csvtakes a CSV with a header row.
In the desktop app, the same option is under Run with Parameters in
the Collection Runner. Bruno's docs and pricing page list data files there
as a paid-plan feature (Pro, Ultimate and Enterprise on the pricing
page), not part of the free Open Source plan. The CLI is MIT-licensed, and Bru CLI 4.4.0
ran --json-file-path for me with no license or login. Plans change, so
check Bruno's pricing page before you build on either.
Inside an iteration:
- Requests reference row values as
{{email}}in the URL, headers or body, like any other variable. - Scripts read the row with
bru.runner.iterationData.get("email").bru.runner.iterationIndexis the iteration number, starting at 0.
Use JSON for test cases. I converted the data file in this post to CSV
and ran it: every value reached the scripts as a string, so
expectedStatus === 201 was false on every valid row and the run failed.
JSON keeps 201 a number.
If you're migrating from Postman, the
Postman data file guide covers the same idea
with pm.iterationData and Newman.
Bruno test data where every row carries its expected status
The example API has one endpoint, POST /customers, with these rules:
namemust be non-empty.emailmust look like an address and must not be taken already. A duplicate gets409 Conflict.agemust be an integer from 18 to 120.
Invalid input gets a 422 with {"errors": [{"field": "age"}]}, and a
created customer comes back as 201 with its fields. Here the API is the
system under test. If you need to fake a dependency's responses instead,
the same template approach produces
mock API response data.
Every row of the data file is a test case. It says what to send and what should happen:
| Field | Purpose |
|---|---|
row |
The row number, used in test names |
case |
A readable label for the row |
name, email, age |
The request payload |
expectedStatus |
201, 409 or 422 |
expectedField |
For rejected rows, the field the API should flag |
The first seven rows are planted, and each breaks or tests exactly one rule:
| Row | Case | Expected |
|---|---|---|
| 1 | empty name | 422, name |
| 2 | malformed email | 422, email |
| 3 | age 17, below minimum | 422, age |
| 4 | age 18, at minimum | 201 |
| 5 | email already taken (row 4's) | 409, email |
| 6 | age 121, above maximum | 422, age |
| 7 | age 120, at maximum | 201 |
The age cases come in pairs on each side of a limit, because off-by-one bugs sit right at the edge. The guide to boundary values and edge cases explains how to pick them. Every row from 8 on is a valid customer.
The checks below cover status codes and the flagged field, not the full response shape. Checking that the response still matches what consumers expect is a separate job, covered in test data for contract testing.
Generating the Bruno JSON data file from a template
Here's the template. It writes the whole data file as one JSON array:
[
<for(i, 1, getParam('rows', 16))><if(getVar('i') > 1)>,<endIf>
<if(getVar('i') == 4)><setVar('taken', getRandomEmail('example.com'))><endIf>
{
"row": <getVar('i')>,
"case": <if(getVar('i') == 1)>"empty name"
<elseIf(getVar('i') == 2)>"malformed email"
<elseIf(getVar('i') == 3)>"age 17, below minimum"
<elseIf(getVar('i') == 4)>"age 18, at minimum"
<elseIf(getVar('i') == 5)>"email already taken"
<elseIf(getVar('i') == 6)>"age 121, above maximum"
<elseIf(getVar('i') == 7)>"age 120, at maximum"
<else>"valid"<endIf>,
"name": <if(getVar('i') == 1)>""<else>"<getRandomFullName()>"<endIf>,
"email": <if(getVar('i') == 2)>"not-an-email"
<elseIf(getVar('i') == 4 || getVar('i') == 5)>"<getVar('taken')>"
<else>"<getRandomEmail('example.com')>"<endIf>,
"age": <if(getVar('i') == 3)>17
<elseIf(getVar('i') == 4)>18
<elseIf(getVar('i') == 6)>121
<elseIf(getVar('i') == 7)>120
<else><getRandomNumber(19, 90)><endIf>,
"expectedStatus": <if(getVar('i') == 4 || getVar('i') >= 7)>201
<elseIf(getVar('i') == 5)>409
<else>422<endIf>,
"expectedField": <if(getVar('i') == 1)>"name"
<elseIf(getVar('i') == 2 || getVar('i') == 5)>"email"
<elseIf(getVar('i') == 3 || getVar('i') == 6)>"age"
<else>""<endIf>
}<end_for>
]
How it works:
- The row count is a parameter.
getParamreadsrowsand falls back to 16, so a nightly job can ask for 60 rows from the same template. - Planted rows are loop-index conditions. Template expressions have
comparisons (
==,!=,<,<=,>,>=) and&&/||but no arithmetic, so each field checks the row index directly. Rows 1 to 7 are fixed cases, and every row after them is valid. The loop end is inclusive, and<if(getVar('i') > 1)>,<endIf>puts a comma before every row except the first. The control flow docs coverforandif/elseIf/else. takenis the only variable. Row 4 sets it withgetRandomEmail, and rows 4 and 5 both print it. That reuse is the only reason for asetVar. Everything else is decided inline, in its own field.rowprints the loop index. Test names then carry the row number from the data itself. That turned out to matter for Insomnia, as the Insomnia section below shows.- Valid ages stay off the boundaries.
getRandomNumber(19, 90)never draws 18 or 120, so the boundary cases appear only in rows 4 and 7.
Rendered with seed 20261130, the file has 16 rows. Here are rows 1, 4,
5 and 8:
[
{
"row": 1,
"case": "empty name",
"name": "",
"email": "[email protected]",
"age": 40,
"expectedStatus": 422,
"expectedField": "name"
},
{
"row": 4,
"case": "age 18, at minimum",
"name": "Vera Yorkstone",
"email": "[email protected]",
"age": 18,
"expectedStatus": 201,
"expectedField": ""
},
{
"row": 5,
"case": "email already taken",
"name": "Ann Hamworth",
"email": "[email protected]",
"age": 73,
"expectedStatus": 409,
"expectedField": "email"
},
{
"row": 8,
"case": "valid",
"name": "Fenan Rivera",
"email": "[email protected]",
"age": 35,
"expectedStatus": 201,
"expectedField": ""
}
]
The only email that appears twice in the file is the planted one in rows 4 and 5.
Committing the data file next to the Bruno collection
A Bruno collection is a folder of plain-text .bru files, so it's
reviewed and versioned like code. The data file sits inside that folder,
and the template and regen script sit next to it:
repo/
├── api-tests/ # the Bruno collection root
│ ├── bruno.json
│ ├── environments/
│ │ └── local.bru # baseUrl: http://127.0.0.1:3000
│ ├── customers/
│ │ └── create-customer.bru
│ └── data/
│ └── customers.json # generated, committed
├── insomnia/
│ └── customers.yaml # Insomnia export, same data file
└── scripts/
├── customers.tmpl
└── regen-customers.sh
In my runs, the .json file inside the collection folder didn't get in
the way: Bruno loaded the collection and listed only the .bru request.
The regen script is the only code that talks to JsonFabrica. It sends the
raw template to
POST /v1/templates/generate, which
renders a template without saving it, and writes the result into the
collection:
#!/usr/bin/env bash
# Regenerate api-tests/data/customers.json from scripts/customers.tmpl.
# scripts/regen-customers.sh # pinned seed: no diff
# scripts/regen-customers.sh 1759617037 # rebuild a logged seed
# scripts/regen-customers.sh random # let the API pick one
set -euo pipefail
PINNED_SEED=20261130 # change only when you mean to replace the data
API=${JSONFABRICA_URL:-https://api.jsonfabrica.com}
OUT=${OUT:-api-tests/data/customers.json}
ROWS=${ROWS:-16}
SEED=${1:-$PINNED_SEED}
[ "$SEED" = random ] && SEED=null # no seed sent: the API picks one
trap 'rm -f request.json response.json' EXIT
jq -n --rawfile body scripts/customers.tmpl \
--argjson seed "$SEED" --argjson rows "$ROWS" \
'{body: $body, params: {rows: $rows}}
+ (if $seed == null then {} else {seed: $seed} end)' \
> request.json
if ! curl -sS --fail-with-body -X POST "$API/v1/templates/generate" \
-H "Authorization: Bearer ${JSONFABRICA_API_KEY:?set the API key}" \
-H "Content-Type: application/json" \
-d @request.json -o response.json; then
cat response.json >&2; exit 1 # {"error": {"code", "message", ...}}
fi
# Bruno and Inso want a bare array: keep data, print meta.seed.
jq '.data' response.json > "$OUT"
echo "wrote $OUT: $(jq length "$OUT") rows, seed $(jq .meta.seed response.json)"
What to know about it:
- The response is
{ data, meta }.datais the generated array, andmeta.seedis the seed that was used: the one you sent or, withrandom, the one the API picked. Both tools need a bare array, so the script writes onlydataand prints the seed. - Same template, seed and rows give the same file. Running the script twice with the pinned seed produced byte-identical files.
jqbuilds the request.--rawfileputs the template in the body without escaping it by hand, and--argjsonrejects a mistyped seed before any request is sent.- Run it from the repository root. The paths are relative, and
JSONFABRICA_URLexists only so the script can point at something other than the hosted API.
Commit the template, the script and the data file together. Normal test runs, local or CI, only read the committed file. They need no JsonFabrica API key, and the data changes only when someone reruns the script and commits the diff.
The .bru request: assertions and tests from the row
Here's the whole request file, customers/create-customer.bru:
meta {
name: create customer
type: http
seq: 1
}
post {
url: {{baseUrl}}/customers
body: json
auth: none
}
body:json {
{
"name": "{{name}}",
"email": "{{email}}",
"age": {{age}}
}
}
assert {
res.status: eq {{expectedStatus}}
}
script:pre-request {
// One tag per run, made on the first iteration and reused by the
// rest, so the planted duplicate still collides with row 4.
if (bru.runner.iterationIndex === 0 || !bru.getVar("runTag")) {
bru.setVar("runTag", Date.now().toString(36));
}
const data = bru.runner.iterationData;
const email = data.get("email");
if (email.includes("@")) {
data.set("email", email.replace("@", `+${bru.getVar("runTag")}@`));
}
}
tests {
const data = bru.runner.iterationData;
const label = `#${data.get("row")} ${data.get("case")}`;
if (data.get("expectedStatus") === 201) {
test(`${label}: stores the customer`, () => {
expect(res.body.email).to.equal(data.get("email"));
expect(res.body.age).to.equal(data.get("age"));
});
} else {
test(`${label}: flags ${data.get("expectedField")}`, () => {
// Adjust to your API's error format.
const fields = (res.body.errors || []).map((e) => e.field);
expect(fields).to.include(data.get("expectedField"));
});
}
}
The pre-request script is explained in the section on unique values. The rest:
- The body uses the row's keys.
{{age}}is unquoted, so it goes out as a JSON number. A data file doesn't replace the body on its own; only the{{...}}references pull values from the row. - The
assertblock checks the status.res.status: eq {{expectedStatus}}resolves per row, and a mismatch readsexpected 409 to equal 201. In the JUnit report, though, this check is namedres.status eq {{expectedStatus}}on every row, placeholder included. - The
testsblock names the case. Test names start with the row number and label, such as#5 email already taken: flags email, so a report shows which case failed without opening the data file. - A rejection must flag the right field. A status-only check passes
when the API rejects a row for the wrong reason. Checking
expectedFieldcatches a 422 fornameon the row that tests the age. - No per-case logic. The script never decides whether a row should pass. A new case is a template change, not a script change.
Running a Bruno data-driven collection with bru run
bru run has to start in the collection root. From the repository root,
Bru CLI 4.4.0 stopped with You can run only at the root of a collection:
cd api-tests
bru run --env local --json-file-path data/customers.json
Without a path, bru run runs every request in the collection, once per
row. --env local selects environments/local.bru. The output, trimmed
to two iterations and the total, with the duration column cut:
Iteration: 1
customers/create-customer (422 Unprocessable Entity) - 21 ms
Tests
✓ #1 empty name: flags name
Assertions
✓ res.status: eq {{expectedStatus}}
Ran all requests - 21 ms
Iteration: 5
customers/create-customer (409 Conflict) - 2 ms
Tests
✓ #5 email already taken: flags email
Assertions
✓ res.status: eq {{expectedStatus}}
Ran all requests - 2 ms
│ TOTAL │ ✓ PASS │ 16 (16 Passed) │ 16/16 │ 16/16 │
Every planted 4xx counts as a pass, because the assertion compares the
status with the row and not with 2xx. bru run exits with 0 when
everything passes and 1 when anything fails, so a CI step fails on its
own.
Two things to know before adding reports and flags:
- Create the report folder first. With
--reporter-junit results/bruno.xmland noresults/folder, the run went through, then failed to write the report and exited with code 2, even though all 16 rows had passed. - Don't add
--parallelhere. It runs iterations side by side, and row 5 only gets its 409 if row 4 has already created the customer.
Unique Bruno test data on every run
A fixed seed means fixed emails. Run the file twice against an API whose database survives between runs, and the second run collides with the first. With the pre-request script removed, the first run passed and the second failed on every row that expects a 201 (trimmed as above):
Iteration: 8
customers/create-customer (409 Conflict) - 1 ms
Tests
✕ #8 valid: stores the customer
expected undefined to equal '[email protected]'
Assertions
✕ res.status: eq {{expectedStatus}}
expected 409 to equal 201
Ran all requests - 1 ms
│ TOTAL │ ✗ FAIL │ 16 (5 Passed, 11 Failed) │ 5/16 │ 5/16 │
Resetting the database before each run is the cleanest fix. When you
can't, the pre-request script in the .bru file keeps the seeded email
and adds a tag that changes per run, so [email protected]
goes out as [email protected]. How it holds up:
- One tag per run, not per row. The tag is a runtime variable, made on iteration 0 and reused by every later iteration. Rows 4 and 5 still share an address, so the planted duplicate still gets its 409. A fresh tag per row would turn that 409 into a 201.
- The script writes the row, not a variable. In Bru CLI 4.4.0, a
data-file key wins over a runtime variable of the same name when
{{email}}is resolved. I triedbru.setVar("email", …), and the body still went out with the untagged address.iterationData.setisn't in Bruno's documented API (the reference listshas,get,stringifyandunset), but in Bru CLI 4.4.0 it changed the row itself for the rest of the iteration, so the body and thetestsblock both saw the tagged email. - Planted bad values stay bad.
not-an-emailhas no@, so it's sent unchanged.
With the script in place, two runs in a row against the same server both passed, 16 of 16. Only uniqueness changes between runs. Every value that decides the outcome still comes from the committed file.
Running Bruno test data in CI
A CI job checks out the repository, starts the API, and runs the collection against the committed file. It needs no JsonFabrica key, because nothing is generated in CI. A GitHub Actions version:
# .github/workflows/api-tests.yml
name: api-tests
on: [push, pull_request]
jobs:
bruno:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- run: npm install -g @usebruno/[email protected]
- name: Start the API under test
run: |
npm ci
npm start > api.log 2>&1 & # however your API starts
for i in $(seq 30); do
curl -s -o /dev/null http://127.0.0.1:3000 && break
sleep 1
done
- name: Run the collection with the committed data file
working-directory: api-tests
run: |
mkdir -p results
bru run --env local \
--json-file-path data/customers.json \
--reporter-junit results/bruno.xml
Pin the CLI version, as here, so a new release can't change how the data
file is read in the middle of a sprint. The run-tag script also relies on
bru.runner.iterationData.set, which isn't in Bruno's documented API, so
a pinned version is the one you know it works on. Bruno also publishes an official
GitHub Action, usebruno/bruno-cli-action, which installs the CLI and
runs a bru command you give it. I ran the commands above locally, not
this workflow on GitHub.
When a row fails here, the committed file holds its exact values. Run
the same bru run locally against your own server and you send the
same request.
Insomnia test data: the same file in the Collection Runner and Inso
Insomnia reads the same file. Its docs describe an Upload Data button
in the Collection Runner that takes a JSON or CSV file. Row values are
available as {{ name }} in requests and as
insomnia.iterationData.get("name") in scripts. Insomnia's pricing page
lists unlimited collection runs and Inso CLI access on the free plan.
For the command line, here's a collection export with the same request. I wrote it by hand in Insomnia's v5 export format. Inso 13.5.0 loaded and ran it, but I didn't import it into the desktop app:
type: collection.insomnia.rest/5.0
name: customers-api
meta:
id: wrk_customers
created: 1764489600000
modified: 1764489600000
collection:
- url: "{{ _.baseUrl }}/customers"
name: create customer
meta:
id: req_create_customer
created: 1764489600000
modified: 1764489600000
isPrivate: false
sortKey: -1764489600000
method: POST
headers:
- name: Content-Type
value: application/json
body:
mimeType: application/json
text: |-
{
"name": "{{ name }}",
"email": "{{ email }}",
"age": {{ age }}
}
scripts:
preRequest: |-
// Set on every row: in Inso 13.5.0, a local var left over from
// the previous iteration was still set on the next one.
const email = insomnia.iterationData.get("email");
const tag = insomnia.variables.get("runTag"); // --env-var
insomnia.variables.localVars.set("email",
tag && email.includes("@")
? email.replace("@", `+${tag}@`)
: email);
afterResponse: |-
const data = insomnia.iterationData;
const label = `#${data.get("row")} ${data.get("case")}`;
const expected = data.get("expectedStatus");
insomnia.test(`${label}: returns ${expected}`, () => {
insomnia.expect(insomnia.response.code).to.eql(expected);
});
if (expected !== 201) {
insomnia.test(`${label}: flags ${data.get("expectedField")}`,
() => {
const errors = insomnia.response.json().errors || [];
insomnia.expect(errors.map((e) => e.field))
.to.include(data.get("expectedField"));
});
}
environments:
name: Base Environment
meta:
id: env_base
created: 1764489600000
modified: 1764489600000
isPrivate: false
data:
baseUrl: http://127.0.0.1:3000
Environment values are read as {{ _.baseUrl }}, while row values sit at
the top level as {{ name }}. Run it with inso run collection, passing
the data file with -d (long form --iteration-data):
inso run collection -w insomnia/customers.yaml \
-d api-tests/data/customers.json \
-n "$(jq length api-tests/data/customers.json)" \
--env-var runTag="$(date +%s)" --ci
The last lines of the output:
✅ #16 valid: returns 201
Test: 1 passed, 1 total
Test Requests: 16 passed, 16 total
Tests: 21 passed, 21 total
Inso 13.5.0 behaved differently from Bruno in three ways:
-ddidn't set the number of iterations. Without-n, Inso ran only the first row and reported success. With-n 18on the 16-row file, iterations 17 and 18 started over at rows 1 and 2. Thejq lengthcall keeps-nequal to the row count.- Local variables carried over between iterations. A pre-request
script that only set
localVarsfor rows with an@left row 1's tagged address in place for row 2. Row 2 then sent a valid email instead ofnot-an-emailand got a 201. The script above sets the variable on every row for that reason. A local variable does take precedence over the row value in{{ email }}. insomnia.info.iterationread 1 on every iteration. That's why therowfield lives in the data.
The run tag itself comes from --env-var: insomnia.variables.get sees
the value passed on the command line. Without it, the script sends the
seeded emails unchanged, which is fine against a fresh database.
Inso's help text says --bail aborts after the first non-200 response.
In my runs it didn't stop at the planted 4xx rows, but going by the help
text, leave it off for a file like this one. When a test fails, Inso
exits with code 1, so it slots into CI the same way as bru run.
Reproducing a failed run from its seed
The pinned file keeps every run identical, which is what you want on each pull request. It also never tests anything the 16 rows don't contain. A scheduled job can cover more ground: generate a fresh, larger file with a random seed, run it, and keep the seed in the log. Those steps, in a nightly workflow whose other steps match the CI job above:
- name: Generate a fresh data set (not committed)
env:
JSONFABRICA_API_KEY: ${{ secrets.JSONFABRICA_API_KEY }}
OUT: api-tests/data/nightly.json
ROWS: 60
run: scripts/regen-customers.sh random
- name: Run the collection against it
working-directory: api-tests
run: bru run --env local --json-file-path data/nightly.json
To try that, I gave the API a realistic bug: a name check of
^[A-Za-z ]+$, which rejects hyphenated surnames. The pinned file
passed, because none of its 16 names has a hyphen. The first two random
seeds passed too. The third failed one row out of 60. The output is
trimmed as above, and I wrote the file to a temporary path, shown here
as the workflow's:
wrote api-tests/data/nightly.json: 60 rows, seed 1759617037
Iteration: 32
customers/create-customer (422 Unprocessable Entity) - 2 ms
Tests
✕ #32 valid: stores the customer
expected undefined to equal '[email protected]'
Assertions
✕ res.status: eq {{expectedStatus}}
expected 422 to equal 201
The failure doesn't show the name, but the seed rebuilds the file. Same template commit, same seed, same row count:
OUT=/tmp/nightly.json ROWS=60 scripts/regen-customers.sh 1759617037
jq '.[31]' /tmp/nightly.json
The rebuilt file was byte-identical to the nightly one, and row 32 shows the cause:
{
"row": 32,
"case": "valid",
"name": "Mackenzie Lang-Ferguson",
"email": "[email protected]",
"age": 71,
"expectedStatus": 201,
"expectedField": ""
}
Running bru run against /tmp/nightly.json failed on #32 again. The
seed only reproduces the file together with the template that made it.
After the template change below, the same seed renders different rows,
so replay from the same commit as the failing run.
A case found this way belongs in the committed file as a planted row. Three lines in the template make row 8 a hyphenated surname:
<elseIf(getVar('i') == 7)>"age 120, at maximum"
<elseIf(getVar('i') == 8)>"hyphenated surname"
<else>"valid"<endIf>,
"name": <if(getVar('i') == 1)>""
<elseIf(getVar('i') == 8)>"<getRandomName()> <getRandomSurname()>-Hall"
<else>"<getRandomFullName()>"<endIf>,
getRandomName and
getRandomSurname supply the parts.
Rerunning the regen script with the pinned seed changed exactly one row
of the committed file: row 8 went from Fenan Rivera to Fenan Rivera-Hall, and every other row stayed the same. Don't count on that
with other edits. Adding or removing random calls usually shifts every
value after the change, which is why the regenerated file belongs in the
same pull request as the template. Against the buggy API, the pinned
file now failed on row 8, #8 hyphenated surname, in both bru run and
Inso. With the name check fixed, both passed. The
reproducible-seeds guide on
replaying a failure from its seed
covers the same loop for unit tests.
FAQ
How do I use a CSV or JSON data file in Bruno?
In the desktop app, open the Collection Runner, pick the file under Run
with Parameters and start the run. From the command line, run bru run
from the collection root with --json-file-path data.json or
--csv-file-path data.csv. Bruno runs the collection once per row. Each
key or column becomes a variable you can use as {{name}} in the URL,
headers and body, and scripts read the current row with
bru.runner.iterationData.get("name").
Is data-driven testing free in Bruno?
Bruno's docs and pricing page list CSV and JSON data files in the
Collection Runner as a paid-plan feature (Pro, Ultimate and Enterprise
on the pricing page), not part of the free Open Source plan. The Bruno CLI is
MIT-licensed, and Bru CLI 4.4.0 ran --json-file-path without a license
or login in my tests. Plans change, so check Bruno's current pricing page
before relying on either.
Should I use CSV or JSON for Bruno test data?
Use JSON when scripts compare values. With a CSV file, every value
reached the scripts as a string in Bru CLI 4.4.0, so a check like
expectedStatus === 201 failed on every row. A JSON data file keeps
201 a number and true a boolean. The file must be a top-level array
with one object per iteration.
How do I run an Insomnia collection with a data file from the command line?
Use Inso CLI:
inso run collection -w export.yaml -d data.json -n 16, where -d
(long form --iteration-data) takes a JSON or CSV file and -n sets the
number of iterations. In Inso 13.5.0, -d didn't set the iteration count
by itself: without -n it ran only the first row, so pass the row count
explicitly. Inso exits with code 1 when a test fails.
How do I make test data unique on every Bruno run?
Keep the seeded values in the committed file and add a per-run tag in a
pre-request script. Create the tag once per run with bru.setVar and
write the tagged value back with bru.runner.iterationData.set, because
in Bru CLI 4.4.0 a data-file key wins over a runtime variable with the
same name. iterationData.set isn't in Bruno's documented API, but it
worked in Bru CLI 4.4.0, so pin the CLI version. Resetting the test database before each run is the simpler
fix when you can do it.
Is there a JsonFabrica Bruno or Insomnia plugin?
No. JsonFabrica is a JSON-over-HTTP API (plus an MCP server for AI coding assistants). It has no Bruno or Insomnia plugin, no Bruno or Insomnia npm package and no database connector. Your own regen script sends a template and a seed to the API and writes the generated JSON into your repository. Bruno and Insomnia then load that committed file as an ordinary data file and never call JsonFabrica.
One template, a pinned seed and a committed JSON file give a Bruno collection, and an Insomnia one, valid rows, planted invalid rows and exact boundaries that run the same way on every machine. Seeded rendering of a raw template is a single call to the JsonFabrica API, documented in the templates API reference.
Generate realistic test data with JsonFabrica
Describe the shape of your data once, then generate as many fresh, realistic JSON documents as you need via a simple API call.