clone_test_case
Copy a test case in its own project using its source key, duplicating fields and optionally the script. The folder must exist; returns the new key and URL.
Instructions
Copy a test case inside its own project (GET /testcase/{testCaseKey}, then POST /testcase). Copies name, objective, precondition, folder, status, priority, component, owner, estimatedTime, labels, custom fields, parameters and — unless includeScript is false — the script; step ids are dropped so the copy owns its steps. Issue links, attachments and execution history are NOT copied. name defaults to " (copy)" and folder to the source folder. The folder MUST already exist — the API never creates folders implicitly (use create_folder first). A test case name is limited to 255 CHARACTERS, not bytes (the API rejects a longer one with an opaque HTTP 500): an explicit longer name is refused locally before any request, and the default name is shortened to fit — the copied source name is cut on a whole-character boundary (an astral character is dropped rather than split), the " (copy)" marker is kept, and note reports both lengths. An explicitly empty name ("") is sent as-is and rejected with 400 "The field name is required." — omit the parameter to get the default. Names are not deduplicated: cloning twice gives two cases with the same name, and cloning a copy gives "… (copy) (copy)" — unless the source name is already at the limit, where the shortening cuts exactly the previous " (copy)" off and the copy ends up named identically to its source (note says so; pass an explicit name to tell them apart). With includeScript=false the copy has no steps, but the API still reports an empty PLAIN_TEXT testScript — that is what every script-less case looks like here. Returns { key, url, sourceKey, note? }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name of the copy, at most 255 characters (defaults to "<source name> (copy)", shortened to fit) | |
| folder | No | Folder path for the copy, full path from the root starting with "/" (defaults to the source folder) | |
| testCaseKey | Yes | Key of the SOURCE test case, e.g. PROJ-T123 | |
| includeScript | No | Copy the test script too (default true) |