Test Cases
Test cases are the core unit of testing in TestBro. Each test case describes a scenario to verify, broken down into sequential steps with actions and assertions.
Test Case Structure
A test case consists of:
- Name -- A short, descriptive title (e.g., "User can log in with valid credentials")
- Description -- Optional additional context about what is being tested
- Steps -- An ordered list of actions to perform and conditions to verify
Step Fields
Each step includes:
| Field | Required | Description |
|---|---|---|
action | Yes | The action type: navigate, click, type, wait, scroll, assert, hover, select |
description | Yes | Human-readable description of what this step does |
target | No | The element to interact with (selector info or element description) |
value | No | Value to type, URL to navigate to, or time to wait |
assertion | No | For assert actions: what to verify (visible, text, url, count) |
Creating Test Cases
From the Dashboard
- Open a project in the dashboard
- Click Add Test Case
- Fill in the name, description, and steps
- Save the test case
From a PRD or Description File
Generate test cases from a requirements document or feature description:
testbro generate --file feature-spec.md --save --project <project-id>
The --save flag saves the generated test cases to the project. Without it, the test cases are displayed but not persisted.
From a Text Description
Generate from an inline description:
testbro generate --description "Login form with email and password, forgot password link, and remember me checkbox" --save --project <project-id>
Via the Run Command
You can generate and immediately run tests from a file:
testbro run --url https://your-app.com --file acceptance-criteria.md --mode ai --project <project-id>
This generates test cases, saves them to the project, and runs them in a single command.
Test Case Sources
Test cases track their origin:
- generated -- Created by AI from a description or file
- manual -- Created manually in the dashboard
- imported -- Imported from an external source
Deduplication
When generating test cases from a file, TestBro checks for duplicates against existing test cases in the project. This prevents the same scenario from being tested multiple times.
Control deduplication behavior:
# Skip deduplication entirely
testbro run --file spec.md --no-dedup --project <id>
# Auto-merge duplicates without prompting
testbro run --file spec.md --auto-merge --project <id>
You can also configure deduplication in test-bro.config.json:
{
"deduplication": {
"enabled": true,
"autoMerge": false
}
}
Bulk Create
Create multiple test cases at once via the API:
POST /api/projects/:id/test-cases/bulk
The bulk endpoint supports deduplication modes: skip (ignore duplicates), force (create all), or smart_merge (merge similar test cases).
Running Specific Test Cases
Run a single test case by ID:
testbro run --url https://your-app.com --test-case <test-case-id> --mode ai
Or run all test cases in a project:
testbro run --url https://your-app.com --project <project-id> --mode hybrid
Next Steps
- Projects -- Organizing test cases into projects
- Execution Modes -- How tests are executed
- CLI Reference -- Full command documentation