HOW TO UPDATE JIRA XRAY TEST EXECUTION AUTOMATICALLY USING REST API C#?

Yosuva ArulanthuRanorexLeave a Comment

I have used RestSharp package for the below c# example

var client = new RestClient("https://jira.example.com/rest/raven/1.0/import/execution");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic <encoded user name and password>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\r\n    \"testExecutionKey\": \"JOS-1\",\r\n\t    " +
                     "\"tests\" : [\r\n\t        {\r\n\t            " +
                     "\"testKey\" : \"JOS-2\",\r\n\t            " +
                     "\"start\" : \"2020-03-27T11:47:35+01:00\",\r\n\t            " +
                     "\"finish\" : \"2020-03-27T11:50:56+01:00\",\r\n\t            " +
                     "\"comment\" : \"Successful execution\",\r\n\t            " +
                     "\"status\" : \"PASS\"\r\n\t        }\r\n\t     ]\r\n}",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Leave a Reply

Your email address will not be published. Required fields are marked *