HomeGeneral DiscussionAutomation:


I am trying to automate the creation of execution plans so that when our build server kicks of the automated tests we have as the final step, the scripts can create a new execution plan and log to it.

I can create the plan but I am having no luck assigning tests or suites to it.

class TestCollab():
def __init__(self):
self.api_key = "*************************09dd207e24819fb"
self.collabBase_url = "http://************.app.testcollab.com/index.php"
self.pythonUserName = "User_4"

def createNewExecutionPlan(self, projectId, executionPlanName, executionPlanPriority):
# construct body
data = {"data": {"Execution": {"title": executionPlanName, "priority": executionPlanPriority}}}
json_data = json.dumps(data)

# construct uri
uri = self.collabBase_url + "/project/" + projectId + "/executions/add.json?API_KEY=" + self.api_key

r = req.REQ()
result = r.post(uri, json_data)
return result

def addTestsToExecutionPlan(self, projectId, executionPlanId, userId, suiteIds, testCaseIds):
# construct body
suitesVal = "[" + suiteIds + "]"
testCasesVal = "[" + testCaseIds + "]"
data = {'data': {'Execution': {'assign_map': {userId: {'suites': suitesVal, 'testCases': testCasesVal}}}}}
json_data = json.dumps(data)
# build uri string
uri = self.collabBase_url + '/project/' + projectId + '/executions/assignTest/' + executionPlanId + '.json?API_KEY=' + self.api_key

r = req.REQ()
result = r.post(uri, json_data)
return result

tc = TestCollab()
res = tc.createNewExecutionPlan("17", "Enqueue Service v1 Test 11/16/2017", "1")
if res[0] == 200:
raw_json = json.loads(res[1])
executionPlanID = raw_json['data']['created_id']
tassign_res = tc.addTestsToExecutionPlan("17", executionPlanID, tc.pythonUserName, "161", "")

req.Req() is just a thin wrapper around requests that I use to trim down the amount of info coming back from requests

when I execute the above I get

[200, '{"status":true,"message":"The Execution has been saved!","data":{"created_id":"90"},"appState":"\\u002fproject\\u002f17\\u002fexecutions\\u002fassignTest\\u002f90"}', 'http://************.app.testcollab.com/index.php/project/17/executions/add.json?API_KEY=*************************09dd207e24819fb']

{"data": {"Execution": {"assign_map": {"User_4": {"suites": "[161]", "testCases": "[]"}}}}}
[200, '[]', 'http://************.app.testcollab.com/index.php/project/17/executions/assignTest/90.json?API_KEY=*************************09dd207e24819fb']

The execution plan is created and it shows as created by me but there is no suite assigned to it and the plan is not assigned to anyone.

I could really use some help getting this last bit of automation up off the ground.

Thank you.
Bill Cook | email
Nov 17 2017, 07:17 PM
Hi Bill,

Thanks for writing in and sharing the details of the issue you encountered.

We would investigate the matter and get back to you at our earliest.

Thanks and Regards
Vishal Vaswani | email
2 days, 17 hours since original post
This topic is closed
Test Case Management
Test Collab Support
Product Tour