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:

FieldRequiredDescription
actionYesThe action type: navigate, click, type, wait, scroll, assert, hover, select
descriptionYesHuman-readable description of what this step does
targetNoThe element to interact with (selector info or element description)
valueNoValue to type, URL to navigate to, or time to wait
assertionNoFor assert actions: what to verify (visible, text, url, count)

Creating Test Cases

From the Dashboard

  1. Open a project in the dashboard
  2. Click Add Test Case
  3. Fill in the name, description, and steps
  4. 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