web-servicesrallywsapi

How to add mutiple test case results using WSAPI in Rally?


I am able to add a single test case result using the /testcaseresult/create API and passing the JSON as:

 {
    "testcaseresult":
    {
        "Build":5,
        "Date":"2017-02-27T18:03:29.260Z",
        "Testcase":{"_ref":"https://rally1.rallydev.com/slm/webservice/v2.0/TestCase/12345678"},
        "Verdict":"Pass"
    }
 }

Is there a way to add multiple test case results?


Solution

  • You can use the wsapi batch endpoint to create multiple items at the same time:

    post url: https://rally1.rallydev.com/slm/webservice/v2.0/batch

    post body:

    {
        "Batch": [
            {
                "Entry": {
                    "Path": "/testcaseresult/create",
                    "Method": "POST",
                    "Body": {
                        "testcaseresult": {
                            "Build":5,
                            "Date":"2017-02-27T18:03:29.260Z",
                            "Testcase": "/TestCase/12345678",
                            "Verdict":"Pass"
                         }
                    }
                }
            },
            {
                "Entry": {
                    "Path": "/testcaseresult/create",
                    "Method": "POST",
                    "Body": {
                        "testcaseresult": {
                            "Build":5,
                            "Date":"2017-02-27T18:03:29.260Z",
                            "Testcase": "/TestCase/1234",
                            "Verdict":"Fail"
                         }
                    }
                }
            }
        ]
    }