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

# 建立測試案例

> 為專案建立新的測試案例

## 請求

```bash theme={null}
POST https://api.pathors.com/v1/projects/{projectId}/test-cases
```

### 路徑參數

<ParamField path="projectId" type="string" required>專案 ID</ParamField>

### 標頭

<ParamField header="Authorization" type="string" required>
  使用您的 Developer Key 進行 Bearer 令牌認證
</ParamField>

### 請求主體

<ParamField body="name" type="string" required>
  測試案例的名稱
</ParamField>

<ParamField body="systemPrompt" type="string" required>
  測試中用於模擬使用者的系統提示
</ParamField>

<ParamField body="maxTurns" type="integer" required>
  對話的最大輪數（最小值為 1）
</ParamField>

<ParamField body="variables" type="object">
  要注入測試中的變數鍵值對
</ParamField>

<ParamField body="acceptanceCriteria" type="array">
  驗收標準描述的陣列（字串）
</ParamField>

## 回應

回傳建立的測試案例，狀態碼為 `201`。

### 範例

```bash theme={null}
curl -X POST https://api.pathors.com/v1/projects/{projectId}/test-cases \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Greeting flow",
    "systemPrompt": "You are a customer asking about pricing",
    "maxTurns": 5,
    "variables": { "language": "en" },
    "acceptanceCriteria": [
      "Agent should greet the user",
      "Agent should provide pricing info"
    ]
  }'
```

```json theme={null}
{
  "data": {
    "id": "test-case-uuid",
    "projectId": "project-uuid",
    "name": "Greeting flow",
    "systemPrompt": "You are a customer asking about pricing",
    "maxTurns": 5,
    "variables": { "language": "en" },
    "acceptanceCriteria": [
      {
        "id": "criterion-uuid-1",
        "testCaseId": "test-case-uuid",
        "description": "Agent should greet the user"
      },
      {
        "id": "criterion-uuid-2",
        "testCaseId": "test-case-uuid",
        "description": "Agent should provide pricing info"
      }
    ],
    "createdAt": "2026-03-23T00:00:00.000Z",
    "updatedAt": "2026-03-23T00:00:00.000Z"
  }
}
```
