How to upload Cucumber execution results to Zephyr Scale [JAVA]

Yosuva ArulanthuJava, Selenium, Test Automation, TestingLeave a Comment

It Creates a new Test Cycle based on provided automated test results.
This endpoint receives a zip file containing one or more Cucumber Json Output file.
Below is the java example to upload Cucumber execution results to Zephyr Scale

package com.yosuva.tests;
import java.io.File;
import org.testng.Assert;
import static io.restassured.RestAssured.*;
import io.restassured.RestAssured;
import io.restassured.response.Response;
 
public class ZephyrScaleUploadTestExecutionResult {
 
  public void updateZephyrTestCase() {
 
  File file=new File(System.getProperty("user.dir")+ \\target\\cucumber\\Report.zip);
  RestAssured.baseURI=https://api.zephyrscale.smartbear.com/v2/automations/executions/cucumber;
  Response response = given().queryParam("projectKey", "ABC")
  .multiPart(file)
  .headers("Authorization", "Bearer Auth_token")
  .contentType("multipart/form-data")
  .when()
  .post()
  .then()
  .extract().response();
 
  System.out.println("Status Code : "+response.statusCode());
  System.out.println("Response Body : "+response.getBody().asString());
 
  Assert.assertEquals(response.statusCode(),200);
  }
 
}

Leave a Reply

Your email address will not be published.