|
1 | 1 | --- |
2 | 2 | title: Test Cases |
3 | | -description: Create test cases |
| 3 | +description: Create, list, update, and delete test cases |
4 | 4 | --- |
5 | 5 |
|
6 | | -Create test cases for your products. |
| 6 | +Create and manage test cases for your products. |
| 7 | + |
| 8 | +## Get test case |
| 9 | + |
| 10 | +Retrieve a specific test case by ID. |
| 11 | + |
| 12 | +**Endpoint:** `GET /products/{product_id}/test_cases/{test_case_id}` |
| 13 | + |
| 14 | +**Parameters:** |
| 15 | + |
| 16 | +- `product_id` (number, required) - ID of the Product |
| 17 | +- `test_case_id` (number, required) - ID of the Test Case |
| 18 | + |
| 19 | +**Example Request:** |
| 20 | + |
| 21 | +{% code language="bash" showLineNumbers=true %} |
| 22 | + |
| 23 | +```bash |
| 24 | +curl -X GET "https://api.test.io/customer/v2/products/1/test_cases/123" \ |
| 25 | + -H "Authorization: Token YOUR_API_TOKEN" |
| 26 | +``` |
| 27 | + |
| 28 | +{% /code %} |
| 29 | + |
| 30 | +**Response:** `200 OK` |
| 31 | + |
| 32 | +Returns the test case object. See the response shape in [Create a bulk of test cases](#create-a-bulk-of-test-cases) below. |
| 33 | + |
| 34 | +## List test cases |
| 35 | + |
| 36 | +Returns all visible (non-hidden) test cases for a product. |
| 37 | + |
| 38 | +**Endpoint:** `GET /products/{product_id}/test_cases` |
| 39 | + |
| 40 | +**Parameters:** |
| 41 | + |
| 42 | +- `product_id` (number, required) - ID of the Product |
| 43 | + |
| 44 | +**Example Request:** |
| 45 | + |
| 46 | +{% code language="bash" showLineNumbers=true %} |
| 47 | + |
| 48 | +```bash |
| 49 | +curl -X GET "https://api.test.io/customer/v2/products/1/test_cases" \ |
| 50 | + -H "Authorization: Token YOUR_API_TOKEN" |
| 51 | +``` |
| 52 | + |
| 53 | +{% /code %} |
| 54 | + |
| 55 | +**Response:** `200 OK` |
| 56 | + |
| 57 | +Returns an array of test case objects. See the response shape in [Create a bulk of test cases](#create-a-bulk-of-test-cases) below. |
7 | 58 |
|
8 | 59 | ## Create a bulk of test cases |
9 | 60 |
|
@@ -69,3 +120,72 @@ Returns an array of created test case objects. |
69 | 120 | {% callout type="note" %} |
70 | 121 | In the response, the steps field is returned as `steps` (not `test_case_steps` as in the request). Each step object in the response also includes `id`, `test_case_id`, and `target_idx` fields. |
71 | 122 | {% /callout %} |
| 123 | + |
| 124 | +## Update test case |
| 125 | + |
| 126 | +Updates the top-level fields of a test case. Test case steps are not managed through this endpoint. |
| 127 | + |
| 128 | +**Endpoint:** `PUT /products/{product_id}/test_cases/{test_case_id}` |
| 129 | + |
| 130 | +**Parameters:** |
| 131 | + |
| 132 | +- `product_id` (number, required) - ID of the Product |
| 133 | +- `test_case_id` (number, required) - ID of the Test Case |
| 134 | + |
| 135 | +All attributes must be provided inside the root object `test_case`. All fields are optional — only the fields you provide are updated. |
| 136 | + |
| 137 | +**Request Body:** |
| 138 | + |
| 139 | +- `title` (string, optional) - Title of the test case |
| 140 | +- `requirements` (string, optional) - Requirements of the test case |
| 141 | +- `target_idx` (string, optional) - Reference of the test case in other system |
| 142 | +- `feature_id` (number, optional) - ID of the Feature to move the test case to. Must belong to the same product. |
| 143 | + |
| 144 | +**Example Request:** |
| 145 | + |
| 146 | +{% code language="bash" showLineNumbers=true %} |
| 147 | + |
| 148 | +```bash |
| 149 | +curl -X PUT "https://api.test.io/customer/v2/products/1/test_cases/123" \ |
| 150 | + -H "Authorization: Token YOUR_API_TOKEN" \ |
| 151 | + -H "Content-Type: application/json" \ |
| 152 | + -d '{ |
| 153 | + "test_case": { |
| 154 | + "title": "Login Test (updated)" |
| 155 | + } |
| 156 | + }' |
| 157 | +``` |
| 158 | + |
| 159 | +{% /code %} |
| 160 | + |
| 161 | +**Response:** `200 OK` |
| 162 | + |
| 163 | +Returns the updated test case object. See the response shape in [Create a bulk of test cases](#create-a-bulk-of-test-cases) above. |
| 164 | + |
| 165 | +## Delete test case |
| 166 | + |
| 167 | +Deletes the specified test case from the product. |
| 168 | + |
| 169 | +**Endpoint:** `DELETE /products/{product_id}/test_cases/{test_case_id}` |
| 170 | + |
| 171 | +**Parameters:** |
| 172 | + |
| 173 | +- `product_id` (number, required) - ID of the Product |
| 174 | +- `test_case_id` (number, required) - ID of the Test Case |
| 175 | + |
| 176 | +{% callout type="note" %} |
| 177 | +If the test case is already in use by a test cycle, it is not permanently deleted — it is hidden instead so historical test results remain intact. Hidden test cases no longer appear in [List test cases](#list-test-cases). |
| 178 | +{% /callout %} |
| 179 | + |
| 180 | +**Example Request:** |
| 181 | + |
| 182 | +{% code language="bash" showLineNumbers=true %} |
| 183 | + |
| 184 | +```bash |
| 185 | +curl -X DELETE "https://api.test.io/customer/v2/products/1/test_cases/123" \ |
| 186 | + -H "Authorization: Token YOUR_API_TOKEN" |
| 187 | +``` |
| 188 | + |
| 189 | +{% /code %} |
| 190 | + |
| 191 | +**Response:** `204 No Content` |
0 commit comments