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

Include the response body in the AssertionError message #1787

Open
zAlbee opened this issue Apr 29, 2024 · 0 comments
Open

Include the response body in the AssertionError message #1787

zAlbee opened this issue Apr 29, 2024 · 0 comments

Comments

@zAlbee
Copy link

zAlbee commented Apr 29, 2024

I would like to request the option to automatically include the response body in the exception message when a request validation fails.

Before you ask, we are already using the config that logs requests when validation fails. This works, but takes extra manual effort to find the response in our logs. We are running our RestAssured tests using Jenkins, which analyzes the TestNG result and shows the name of each failed test, and links to the exception message and stack trace. However, the exception is not linked to the console log! We have to go into the console log (which is several megabytes, because our test suite is huge and has a lot of noise) to manually search for it.

It would be really nice if the response body was included in that exception message, so we don't have to go searching for it. A lot of times, assertion errors look the same ("Expected status code 200 but was 422"), but the body clarifies the error (e.g. "The job is already running").

I looked into the code and suspect something could be added to this line of validate(Response) method, but I am not a Groovy developer....

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

1 participant