Hi all
I am trying to automatically create a Xray Test Execution.
Will appreciate some help as to how to go about doing it. This is my first attempt at creating a Xray Test Execution automatically via rest api.
This is the snapshot of the code sending the HTTP Post request
public String BasicAuthPostRequest(String baseURI, String resource, String jsonStr, String username, String password) {
RestAssured.baseURI = baseURI;
RequestSpecification request = RestAssured.given().contentType(ContentType.JSON).auth().preemptive().basic(username, password)
.body(jsonStr);
Response resp = request.post(resource);
String returnStr = (resp.getStatusCode() == 200) ? resp.getBody().prettyPrint() : null;
return returnStr;
}
The body (jsonStr) is:
{"fields":{"project":{"key":"XPPS"},
"summary":"WSS WatchList Test Execution Suite",
"description":"Automated Test Execution Suite Creation",
"issueType":{"name":"Xray Test Execution"}}
}
The resource is:
"/rest/api/2/issue/"
Response from jira server after sending is:
11:39:38.606 [main] DEBUG o.a.h.i.conn.DefaultClientConnection - Receiving response: HTTP/1.1 400 Bad Request
11:39:38.606 [main] DEBUG org.apache.http.headers - << HTTP/1.1 400 Bad Request
11:39:38.606 [main] DEBUG org.apache.http.headers - << x-arequestid: 699x28927049x6
11:39:38.606 [main] DEBUG org.apache.http.headers - << x-anodeid: jira-2
11:39:38.606 [main] DEBUG org.apache.http.headers - << referrer-policy: strict-origin-when-cross-origin
Okay. I found the issue. IssueType should be all lowercaps. Worked after that
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.