Thread

Skip Navigation LinksForums > SpiraTest Forums > SpiraTest Issues & Questi... > How to call SpiraTest API...

How to call SpiraTest API with Python? RSS Feed

Wednesday, January 4, 2012
I write a Python code to call SpiraTest API TestRun_CreateFromTestCases , but it doesn't work.

The code,

from suds.client import Client


client = Client("http://172.16.127.101/SpiraTest/Services/v3_0/ImportExport.svc?wsdl")
client.service.Connection_Authenticate("w9504102","password")
client.service.Connection_ConnectToProject(6)

client.service.TestRun_CreateFromTestCases(180)



It always errors as below,

C:\temp>python TestRun_CreateFromTestCases.py
No handlers could be found for logger "suds.client"
Traceback (most recent call last):
  File "TestRun_CreateFromTestCases.py", line 10, in <module>
    client.service.TestRun_CreateFromTestCases(180)
  File "build\bdist.win-amd64\egg\suds\client.py", line 542, in __call__
  File "build\bdist.win-amd64\egg\suds\client.py", line 602, in invoke
  File "build\bdist.win-amd64\egg\suds\client.py", line 649, in send
  File "build\bdist.win-amd64\egg\suds\client.py", line 702, in failed
  File "build\bdist.win-amd64\egg\suds\bindings\binding.py", line 265, in get_fault
suds.WebFault: Server raised fault: 'The formatter threw an exception while trying to deserialize the message: There was an erro
ile trying to deserialize parameter http://www.inflectra.com/SpiraTest/Services/v3.0/:testCaseIds. The InnerException message wa
rror in line 1 position 368. Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''. '.  Please see InnerExc
on for more details.'

Can anyone guide me how to do it?

Thanks,

Jack Fan

1 Replies
Adam SAdam S
re: Jack Fan on Wednesday, January 4, 2012
Thursday, January 5, 2012
You need to pass in an array of test cases to the function not just a single ID. If you look at the API signature, that is what it is expecting.
Tagged
Statistics
  • Started: 1/4/2012
  • Last Reply: 1/5/2012
  • Replies: 1
  • Views: 1958
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2016 | Licensed to Inflectra Corporation.