Open Jacobvu84 opened 1 year ago
String testExecId = getTestExecution(); // (1) TestOutcome testOutcome = getLastOutcome(); String testKeyId = getTestCaseId(testOutcome); TestResult result = testOutcome.getResult(); String statusTC = ""; if(!result.isUnsuccessful()){ statusTC = "PASS"; }else { statusTC = "FAIL"; } JSONObject status=new JSONObject(); status.element("testExecutionKey", testExecId); JSONArray testArray=new JSONArray(); JSONObject test=new JSONObject(); test.element("testKey", testKeyId); test.element("status", statusTC); testArray.add(test); status.element("tests", testArray); SerenityRest.given() .header("Authorization", JIRA_TOKEN) .contentType(ContentType.JSON) .body(status) .post(JIRA_BASE+"/rest/raven/1.0/import/execution");
(1)
@NotNull private static String getTestExecution() { String testExecId; try { testExecId = new String( Files.readAllBytes(Paths.get("testExecId.txt"))); } catch (IOException e) { throw new RuntimeException(e); } return testExecId; }
(1)