Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SerenityRest not reporting Request Params in HTML Report #2076

Closed
SengCheong opened this issue May 9, 2020 · 2 comments
Closed

SerenityRest not reporting Request Params in HTML Report #2076

SengCheong opened this issue May 9, 2020 · 2 comments

Comments

@SengCheong
Copy link

SengCheong commented May 9, 2020

Hi,

I am unable to view the request body when issuing a rest-assured request with SerenityRest.

Screen Shot 2020-05-09 at 10 23 05 AM

This is in contrast to the screenshot present in this tutorial book:
https://serenity-bdd.github.io/theserenitybook/0.1.0/serenity-rest.html

I performed an initial analysis, and discovered that:

public RestQuery recordRestSpecificationData(final RestMethod method, final RequestSpecificationDecorated spec,
final String path, final Object... params) {
final Map<LogDetail, String> values = new HashMap<>();
for (final Filter filter : spec.getDefinedFilters()) {
if (filter instanceof FieldsRecordingFilter) {
final FieldsRecordingFilter internal = (FieldsRecordingFilter) filter;
values.put(internal.logDetail(), internal.recorded());
}
}
final RestQuery query = RestQuery.
withMethod(method).andPath(ObjectUtils.firstNonNull(values.get(LogDetail.URI).replaceFirst("^Request URI:\t", ""), "")).
withContentType(String.valueOf(
ContentType.fromContentType(spec.getContentType()))
).
withContent(firstNonNull(values.get(LogDetail.BODY), "")).
withRequestCookies(firstNonNull(values.get(LogDetail.COOKIES), "")).
withRequestHeaders(firstNonNull(values.get(LogDetail.HEADERS), ""));
return query;
}

does not record the request body or params e.g. when using .formParams().

I tried setting a custom RestReportingHelper that adds .withParameters() to the rest query, but there was no change in the generated report.

My dependencies are:

  • serenity-jbehave:1.4.6
  • serenity-core: 2.2.1
  • serenity-rest-assured:2.2.1
  • serenity-junit: 2.2.1

Upgrading the dependencies to 2.2.4 did not fix the issue

@SengCheong SengCheong changed the title SerenityRest not reporting Request Body in HTML Report SerenityRest not reporting Request Params in HTML Report May 9, 2020
@wakaleo
Copy link
Member

wakaleo commented May 10, 2020

Could you propose a PR?

@SengCheong
Copy link
Author

Sorry Wakaleo, I have been busy and I did not had the time into looking for a possible solution. From my understanding, it seems that the problem might also extend all the way into the way the HTML report is generated, especially regarding the HTMLAcceptanceTestReporter.java class

I do not have the time currently to investigate how the HTMLAcceptanceTestReporter works at the moment, so I highly suggest you tag this issue as a bug currently. I will see if i am avaliable to propose a PR

@wakaleo wakaleo closed this as completed Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants