Forum Discussion

Rudy's avatar
Rudy
New Member
3 months ago

POST - create test script: step by step issue

Hello,

I am using Zephyr Scale Cloud and encountering an issue when editing test steps.

I am successfully able to:

Create a new test case using POST /v2/testcases with the following JSON:

{
"projectKey": "DZIA",
"name": "Login Test"
}

Edit steps for plain text scripts using:

POST /v2/testcases/DZIA-T176/testscript

{
"type": "plain",
"text": "e.g. Attempt to login to the application"
}

However, I am unable to update test steps one by one (step-by-step) as described in the documentation.

The documentation states: To define your own test steps, use the POST /testcases/{testCaseKey}/teststeps endpoint after creation using OVERWRITE mode AND For Plain Text scripts, we support HTML fragments. To create a step-by-step test script, you should use the POST /testcases/{testCaseKey}/teststeps endpoint.

POST /v2/testcases/{testCaseKey}/teststeps?mode=OVERWRITE
with a JSON body:

[
{
"description": "Your step description",
"expectedResult": "What you expect after the step"
},
{
"description": "Next step description",
"expectedResult": "Next expected result"
}
]

…but this request does not work.

Response:
{
"errorCode": 400,
"message": "Invalid Payload"
}

Questions:

Is the provided JSON structure correct for importing step-by-step instructions?
Could you provide an explicit example (expected JSON payload) for step-by-step test steps?

Thank you guys!

1 Reply

  •  

    The issue you are encountering with the "Invalid Payload" error is due to an incorrect JSON structure for the `POST /v2/testcases/{testCaseKey}/teststeps` endpoint. Based on the information from historical cases and knowledge articles, the correct payload structure for step-by-step test steps in Zephyr Scale Cloud should include a `mode` key and a `steps` key.

    Here is the correct JSON payload format:

    ```json
    {
      "mode": "OVERWRITE",
      "steps": [
        {
          "description": "Your step description",
          "expectedResult": "What you expect after the step"
        },
        {
          "description": "Next step description",
          "expectedResult": "Next expected result"
        }
      ]
    }
    ```

    Resolution Steps

    1. Use the endpoint: `POST /v2/testcases/{testCaseKey}/teststeps`.
    2. Include the query parameter `?mode=OVERWRITE` in the URL.
    3. Ensure the JSON payload follows the structure provided above.