> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coval.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Test Cases

> Manage individual test cases with the Coval CLI

## List Test Cases

```bash theme={null}
coval test-cases list [OPTIONS]
```

| Option          | Type   | Default | Description           |
| --------------- | ------ | ------- | --------------------- |
| `--filter`      | string | —       | Filter expression     |
| `--test-set-id` | string | —       | Filter by test set ID |
| `--page-size`   | number | 50      | Results per page      |
| `--order-by`    | string | —       | Sort order            |

**Output columns:** ID, INPUT, TYPE, TEST SET, CREATED

```bash theme={null}
# List all test cases
coval test-cases list

# Filter by test set
coval test-cases list --test-set-id ts_abc123
```

## Get Test Case

```bash theme={null}
coval test-cases get <test_case_id>
```

| Argument       | Type   | Required | Description      |
| -------------- | ------ | -------- | ---------------- |
| `test_case_id` | string | **Yes**  | The test case ID |

```bash theme={null}
coval test-cases get tc_abc123
```

## Create Test Case

Create a single test case or bulk import from stdin.

```bash theme={null}
coval test-cases create [OPTIONS]
```

| Option          | Type   | Required | Description                       |
| --------------- | ------ | -------- | --------------------------------- |
| `--test-set-id` | string | **Yes**  | Test set to add the case to       |
| `--input`       | string | No       | Test case input text              |
| `--expected`    | string | No       | Expected output                   |
| `--description` | string | No       | Test case description             |
| `--stdin`       | flag   | No       | Read test cases from stdin (JSON) |

<Info>
  You must provide exactly one of `--input` or `--stdin`. They are mutually exclusive — supplying both or neither will result in an error.
</Info>

### Single Test Case

```bash theme={null}
coval test-cases create \
  --test-set-id ts_abc123 \
  --input "I need help with my order" \
  --expected "Order assistance provided" \
  --description "Basic order help request"
```

### Bulk Import from Stdin

Pass `--stdin` to read one JSON object per line:

```bash theme={null}
echo '{"input_str": "I need a refund", "expected_output_str": "Refund processed", "description": "Refund request"}
{"input_str": "Where is my order?", "expected_output_str": "Order status provided", "description": "Order tracking"}' \
  | coval test-cases create --test-set-id ts_abc123 --stdin
```

Or import from a file:

```bash theme={null}
cat test_cases.jsonl | coval test-cases create --test-set-id ts_abc123 --stdin
```

Each line must be valid JSON with the following fields:

| Field                 | Type   | Required | Description     |
| --------------------- | ------ | -------- | --------------- |
| `input_str`           | string | **Yes**  | Input text      |
| `expected_output_str` | string | No       | Expected output |
| `description`         | string | No       | Description     |

## Update Test Case

```bash theme={null}
coval test-cases update <test_case_id> [OPTIONS]
```

| Argument       | Type   | Required | Description                |
| -------------- | ------ | -------- | -------------------------- |
| `test_case_id` | string | **Yes**  | The test case ID to update |

| Option          | Type   | Description         |
| --------------- | ------ | ------------------- |
| `--input`       | string | New input text      |
| `--expected`    | string | New expected output |
| `--description` | string | New description     |

```bash theme={null}
coval test-cases update tc_abc123 --input "Updated input text"
```

## Delete Test Case

```bash theme={null}
coval test-cases delete <test_case_id>
```

| Argument       | Type   | Required | Description                |
| -------------- | ------ | -------- | -------------------------- |
| `test_case_id` | string | **Yes**  | The test case ID to delete |
