How to create a TestCaseStep via WS API

Document ID : KB000057630
Last Modified Date : 14/02/2018
Show Technical Document Details

Issue

This article shows how to create a TestCaseStep using a browser REST client

Resolution

Please see?WS API request examples using curl and browser REST client?? for details on authentication and scoping of WS API requests.

Endpoint:

https://rally1.rallydev.com/slm/webservice/v2.0/testcasestep/create

Payload example:

{"TestCaseStep":{"TestCase":"/testcase/48732872571","Input":"2x2","expectedresult":"4","stepindex":"0"}}

Here is a screenshot from Chrome's Advanced REST Client:

User-added image
If the testcase reference /testcase/123 is invalid, not accessible to the user who authenticates the request, or the request is scoped incorrectly this error will be returned: "Could not read: Could not read referenced object null"

Note that the max length of ExpectedResult is shown in WS API document.

User-added image

To illustrate the limit, a random text of 2048 characters is generated:
User-added image

and the text is used to set ExpectedResult value in the payload. Since this is the second Steps of the same TestCase, stepindex value is also incremented:

User-added image

Here is a screenshot of the response in the REST client:

User-added image

We confirm in the UI that both steps were successfully created:

User-added image

Next, the text length is increased by a single character to demonstrate the error:

{
"CreateResult": {
"_rallyAPIMajor": "2"
"_rallyAPIMinor": "0"
"Errors": [1]
0:? "Validation error: TestCase.steps[3].expectedResult length is greater than the maximum length of 2048"
-
"Warnings": [0]
}-
}

User-added image