如何使用Jira python API标记Jira TCs执行状态失败或通过?
我正在使用jira python模块并从jira获取TCs列表。现在,在执行之后,我想将TCs执行状态标记为失败或通过。我如何实现这一点 我的代码:如何使用Jira python API标记Jira TCs执行状态失败或通过?,python,jira,jira-rest-api,python-jira,Python,Jira,Jira Rest Api,Python Jira,我正在使用jira python模块并从jira获取TCs列表。现在,在执行之后,我想将TCs执行状态标记为失败或通过。我如何实现这一点 我的代码: jserver = {'server':server} j = JIRA(options=jserver,basic_auth=(username,password)) total = 5000 end = 0 c=[] while end <= 5000 : issues_in_proj = j.search_issues('p
jserver = {'server':server}
j = JIRA(options=jserver,basic_auth=(username,password))
total = 5000
end = 0
c=[]
while end <= 5000 :
issues_in_proj = j.search_issues('project=TC',startAt=end,maxResults=1000)
print len(issues_in_proj)
for ticket in issues_in_proj:
issue = j.issue(ticket)
labels = issue.fields.labels
def MarkTcExecutionState(testkey):
NO Idea which method to use, tried to use transition but it changes issue transition state and not execution state
jsserver={'server':server}
j=JIRA(options=jserver,basic_auth=(用户名、密码))
总数=5000
结束=0
c=[]
当结束时
jira服务器的Rest API:
values = {
"executions": [
str(test)
],
"status": str(status_id)
}
def mark_test_status(self,testid,values):
headers = {'Content-Type': 'application/json'}
s = requests.put(str(self.server) +"/rest/zapi/latest/execution/"+str(testid)+"/execute", auth=(self.username, self.password),data=json.dumps(values), headers=headers)
print "test marked as per status"
public String updateExecution(int executionId, String status) throws Exception {
System.out.println("Executing execution with executionId " + executionId + " and status = " + status);
String url = "https://jira.company.com/jira/rest/zapi/latest/execution/" + executionId + "/execute";
//String url = "https://jira.company.com/jira/rest/zapi/latest/execution";
String statusInReq = "";
if (status.equalsIgnoreCase("pass")) {
statusInReq = "1";
} else if (status.equalsIgnoreCase("fail")) {
statusInReq = "2";
}
// Create request body
JSONObject obj = new JSONObject();
obj.put("status", statusInReq);
obj.put("comment", "through java");
String requestBody = obj.toString();
System.out.println("Request body: " + requestBody);
HttpURLConnection conn
= httpPut(url, null, null, obj.toString());
System.out.println("HTTP response code: " + conn.getResponseCode());
String response = getResponse(conn);
System.out.println("HTTP response content: " + response);
System.out.println("from HTTP response content fetch the execution id: " + response.substring(6, 12));
return response;
}