OS: Win 10 2004 x64, Python 3.8.5, tcms-api 8.6
At first I tried to get TestRun that I created manually. It worked perfectly.
from tcms_api import TCMS
rpc_client = TCMS()
targetPlan = rpc_client.exec.TestRun.filter({'id' : 1877})[0]
So I got:
{'notes': 'TestRun', 'id': 1788, 'start_date': '2020-09-18 15:19:18',
'stop_date': '2020-09-18 19:24:38','summary': 'TestRun', 'build_id': 1, 'build': 'unspecified',
'default_tester_id': 17, 'default_tester': 'i.bogomazov', 'manager_id': 17, 'manager': 'i.bogomazov',
'plan_id': 2, 'plan': 'TestPlan', 'product_version_id': 2, 'product_version': '12.0', 'tag': [], 'cc': []}
Next, I tried to create TestRun
with similar values:
trSetting = {'notes':'AutoTestRun', 'start_date':'2020-11-13 11:56:30', 'summary':'Auto create testrun',
'default_tester_id': 17, 'default_tester':'i.bogomazov','build_id': 1, 'build': 'unspecified',
'plan_id':2, 'product_version_id':2, 'product_version':2, 'tag':['auto']}
run = rpc_client.exec.TestRun.create(trSetting)
Here I got an error. But I am using attribute 'product_version_id' that is equal 2 in trSetting:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\i.bogomazov\AppData\Local\Programs\Python\Python37-32\lib\xmlrpc\client.py", line 1112, in __call__
return self.__send(self.__name, args)
File "C:\Users\i.bogomazov\AppData\Local\Programs\Python\Python37-32\lib\xmlrpc\client.py", line 1452, in __request
verbose=self.__verbose
File "C:\Users\i.bogomazov\AppData\Local\Programs\Python\Python37-32\lib\xmlrpc\client.py", line 1154, in request
return self.single_request(host, handler, request_body, verbose)
File "C:\Users\i.bogomazov\AppData\Local\Programs\Python\Python37-32\lib\xmlrpc\client.py", line 1170, in single_request
return self.parse_response(resp)
File "C:\Users\i.bogomazov\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tcms_api\xmlrpc.py", line 41, in parse_response
return super().parse_response(response)
File "C:\Users\i.bogomazov\AppData\Local\Programs\Python\Python37-32\lib\xmlrpc\client.py", line 1342, in parse_response
return u.close()
File "C:\Users\i.bogomazov\AppData\Local\Programs\Python\Python37-32\lib\xmlrpc\client.py", line 656, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault -32603: "Internal error: 'NoneType' object has no attribute 'product_version_id'">
When creating don't use _id
for foreign-key fields. Try:
trSetting = {'notes':'AutoTestRun', 'start_date':'2020-11-13 11:56:30', 'summary':'Auto create testrun', 'default_tester': 17, 'build': 1, 'plan':2, 'product_version':2}
run = rpc_client.exec.TestRun.create(trSetting)