Hello, Thanks for the reply. I tried with all variables, but still it is not working. Could you give me an example of setting results for individual steps using python APIs? http://docs.gurock.com/testrail-faq/config-steps
Also according to http://docs.gurock.com/testrail-faq/config-steps , ‘actual result’ is an optional field, but you suggested to include “all” variables.
Here is my whole code:
#!/usr/bin/python
from testrail import *
from pprint import pprint
import json
client = APIClient('https://testrail.xxx.net/')
client.user = 'xxxx'
client.password = 'xxxxx'
#Each user has its id. This function returns respective user id
def get_user_id():
user_id=client.send_get('get_user_by_email&email=xxx@xxx.com')
#print user_id['id']
return user_id['id']
#Get the test cases for the test run . You need to specify Test run id.
tests=client.send_get('get_tests/22047')
pprint(tests)
AssignedUser=get_user_id()
for value in tests:
if value['custom_parentsteps'] != None:
print("Test ID: %s" %(value['id']))
print("Case ID: %s"%(value['case_id']))
print("%s"%(value['custom_parentsteps']))
data={"custom_step_results": [{"status_id": 2,'content': 'Build and install any sample app on the device.', 'expected': 'App installs successfully.'}]}
client.send_post('add_result/%s'%(value['id']),data)
Sill I am getting following error:
Traceback (most recent call last):
File "add_results_steps_testrail.py", line 38, in <module>
client.send_post('add_result/%s'%(value['id']),data)
File "/Users/nzunjarwad/my_scripts/testrail.py", line 51, in send_post
return self.__send_request('POST', uri, data)
File "/Users/nzunjarwad/my_scripts/testrail.py", line 79, in __send_request
(e.code, error))
testrail.APIError: TestRail API returned HTTP 400 ("One of Status ID, Assigned To or Comment is required")