Skip Navigation LinksForums > SpiraTest Forums > SpiraTest Issues & Questi... > Spiratest 5.0 REST API re...

Spiratest 5.0 REST API record test-run, Example how RSS Feed

Tuesday, August 30, 2016

I found a few methods in API documentation section:

In requests body, there are many fields I have no idea how to use. Could someone please explain with some short example how to record an automated test run?
What preconditions needed in testcase/testset?
What are the required and optional fields in request body?

I am using python script to communicate with REST API 5.0 and getting the error:

The server encountered an error processing the request.

I have the following data in POST request body:

postbody = {"ProjectId":  "3", "ExecutionStatusId": "1", "ReleaseId":  "159", "TestCaseId":"15542", "TestSetId":"654", "TesterId":"586", "RunnerName":"Python" }

The exception message is \'There was an error checking start element of object of type Inflectra.SpiraTest.Web.Services.v5_0.DataObjects.RemoteAutomatedTestRun.
Encountered unexpected character \'T\'.\'. See server logs for more details.

2 Replies
Adam SAdam S
re: Andras N on Tuesday, August 30, 2016
Tuesday, September 6, 2016
Hi Andras

I think the issue is that you need to stringify the JSON before sending:


Andras NAndras N
re: Adam S on Tuesday, September 6, 2016
Tuesday, September 13, 2016
Thanks Adam for your response.

I think I found out the correct way of calling this method.

Here is my working python code:

    def recordTestRun(self , **kwargs ):
        if kwargs.has_key("projectID"):
            self.projectID = kwargs["projectID"]

        postbody = json.dumps( { "ProjectId":2, "ExecutionStatusId":2, "ReleaseId":157, "TestCaseId":33474, "TestSetId":942, "TesterId":145, "RunnerName":"Python" , "StartDate": "/Date(" + str(int(time.time())) + ")/" , "ConcurrencyDate": "/Date(" + str(int(time.time())) + ")/" } )
        url = self.baseURL +  '/projects/2/test-runs/record'
        result = url, headers=self.headers, data = postbody )

        return result

  • Started: 8/30/2016
  • Last Reply: 9/13/2016
  • Replies: 2
  • Views: 363
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2017 | Licensed to Inflectra Corporation.