add_test_steps
Insert new steps into a STEP_BY_STEP Jira test script while keeping existing steps and their ids, at append, prepend, or a 0-based position.
Instructions
Insert steps into a STEP_BY_STEP script without losing the existing ones (GET then PUT /testcase/{testCaseKey}): reads the current steps, keeps their ids, splices the new ones in and writes the whole list back — needed because PUT deletes every step missing from the list it receives. The stored steps are ordered by their authoritative index before merging, because GET /testcase serves them in an arbitrary array order once a case has been edited; only the insertion changes, existing step ids and their sequence are preserved. position selects the insertion point: "append" (the default), "prepend", or a 0-based index into that ordered sequence, clamped to the step count. Allowed when the current script is STEP_BY_STEP, and when the case has no script CONTENT yet — a case created without a testScript is reported by the API as an empty PLAIN_TEXT script (a stub with no text), and that counts as script-less: a STEP_BY_STEP script is then created. A PLAIN_TEXT or BDD script that really has text is refused; replace it with set_test_script. A step whose "Call to Test" points at its own case is refused too: the API answers 2xx to such a write and stores NOTHING. After the write the tool reads the case back (a second GET) and returns { key, totalSteps } where totalSteps is the count STORED on the case, not the count sent. When the two differ — the stand accepts a write and silently throws it away — the answer also carries stepsSent and a warning saying so; totalSteps is null with a warning when the read-back itself failed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| steps | Yes | New steps in insertion order, without ids (ids belong to already stored steps). A step with testCaseKey is a "Call to Test". | |
| position | No | Where to insert: 'append' (default), 'prepend', or a 0-based index into the existing steps, clamped to the current step count. A numeric index may be given as a number or as digits in a string ("2") — both mean the same position. | |
| testCaseKey | Yes | Test case key, e.g. PROJ-T123 |