Loading test datasets from a file glob
A file glob lets the tests key load several test files at once, so a suite can be split into small datasets that promptfoo gathers with one pattern.
Last updated: 15 Oct, 2026 · Promptfoo 0.124.1
The Tests in a CSV file lesson kept every test in one file. A real suite grows past that: orders in one dataset, refunds in another, each owned by a different person. Promptfoo lets tests point at a glob, a path with a * wildcard, and loads every file it matches.
Splitting the tests into datasets
Each file is a plain list of test cases, the same entries that would sit inline under tests. Here the orders dataset holds the A17 question.
- vars:
question: Where is order A17?
assert:
- type: contains
value: 3 March
The refunds dataset is a second file in the same shape, holding the refund question.
- vars:
question: How long does a refund take?
assert:
- type: contains
value: five working days
Gathering them with one pattern
The tests key takes a glob. The pattern file://tests_*.yaml matches every file whose name starts with tests_, so both datasets load and their cases run together. A glob into a folder, such as file://tests/*.yaml, works the same way when the files sit in a directory.
providers:
- file://support_bot.py
prompts:
- "{{question}}"
tests: file://tests_*.yaml
View the code here
# the shop support bot: find the answer in the handbook, or say it is missing
HANDBOOK = {
"a17": "Order A17 shipped on 3 March by courier.",
"refund": "Refunds take five working days.",
}
def call_api(prompt, options, context):
asked = prompt.lower() # the rendered prompt is the question
for key, line in HANDBOOK.items():
if key in asked:
return {"output": line}
return {"output": "I could not find that in the handbook."}
promptfoo eval --no-tableStarting evaluation eval-7DA-2026-10-14T19:17:05 Running 2 test cases (up to 4 at a time)... Creating cache folder at ~/.promptfoo/cache. ✓ Eval complete (ID: eval-7DA-2026-10-14T19:17:05) » View results: promptfoo view » Share with your team: https://promptfoo.app » Feedback: https://promptfoo.dev/feedback Results: ✓ 2 passed (100%) 0 failed (0%) 0 errors (0%) Duration: 0s (concurrency: 4)
What the glob loaded
- Two files, two tests, one run. The glob matched both datasets and promptfoo ran every case it found.
- The order follows the match. Files are gathered in the order the pattern expands, and their cases run in that order.
- Each file stands alone. A dataset is only a list of tests, so one can be edited or added without touching the others or the config.
A glob vs a single file
| A single test file | A glob of files | |
|---|---|---|
| Where tests live | One file | Many files, gathered by a pattern |
| Adding a dataset | Append to the one file | Drop in a file the pattern matches |
| Ownership | One file, one owner | A file per team or topic |
| Config change | None | None, the pattern already matches |
Where loading from a glob helps
- A suite split by topic, orders in one dataset and refunds in another, each editable on its own.
- Tests owned by different people, where a new file is added without a merge conflict in a shared one.
- Generated datasets, where a script writes a file per batch and the glob picks them all up.
file://*.yaml would also sweep up promptfooconfig.yaml and try to read it as tests. Give the datasets a shared prefix, such as tests_, and point the pattern at that, so the config is never caught in the match.Related
- Previous: Tests in a CSV file
- Next: Reusing setup across tests with scenarios
- Reference: Promptfoo test cases docs
- Add a
tests_shipping.yamldataset with one case and rerun; watch three tests run with no config change. - List the two files as explicit
file://entries undertestsinstead of a glob and confirm the same run. - Rename the pattern to
file://*.yamland read the error when the config is loaded as tests.
This is what real progress feels like.