javaseleniumtestngjira-zephyr

Adding stacktrace in zephyr test execution using selenium


we currently have our framework that automatically updates the test execution status in zephyr, I want to improve upon that by adding the stack trace to failed executions as a comment, I am struggling to find any documentation on this, I was wondering if anyone knows if this is possible and if anyone has any documentation that will help me with this?


Solution

  • Resolved with the following method

    public void updateFailedTest(Scenario scenario) {
                String body = "{\"comment\":\"" + logError(scenario) + "\"}";
                request = given()
                        .auth()
                        .preemptive()
                        .basic(System.getenv("USER_NAME"), System.getenv("ZAPI_PASSWORD"))
                        .header("Accept", "application/json")
                        .header("Content-Type", "application/json")
                        .body(body);
                response = request.when().put(readPropertiesFile("ZEPHYR_API_URL") + "/execution/" + executionId + "/execute");
                response.then().log().ifError().statusCode(200);
                response.then().log().all();
        }