So I am using RestAssured to test some endpoints and pulling the test result into an Allure report.
I am currently trying to fill the report with useful information about each test case, like the endopoint pinged. To extract the url I tried using the following:
RequestSpecification requestSpec = RestAssured.given().spec(Request.getRequestSpecification());
QueryableRequestSpecification queryRequest = SpecificationQuerier.query(requestSpec);
String retrieveURI = queryRequest.getBaseUri();
System.out.println("Base URI is : "+retrieveURI);
String retrievePath = queryRequest.getBasePath();
System.out.println("Base PATH is : "+retrievePath);
where the Request.getRequestSpecification() returns a RequestSpecification build with RequestSpecBuilder .
the thing is my basePath is something like /info/{unitId}/something the value here is filled with a pathParameter once built. but the block
String retrievePath = queryRequest.getBasePath();
System.out.println("Base PATH is : "+retrievePath);
returns my basepath with {unitId} in it instead of the actual path parameter passed.
Is there a way to extract the basePath of a RestAssured request with the pathParameter within it ?
note, I know there is .log().uri() but this outputs the info in the counsole and I need it in a variable to send it to the Allure report.