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

WebTestClient assert failures should log request and response details [SPR-15249] #19814

Closed
spring-projects-issues opened this issue Feb 13, 2017 · 1 comment
Assignees
Labels
in: test type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Feb 13, 2017

Rob Winch opened SPR-15249 and commented

Currently WebTestClient has the ability to display request / responses without regard to a failure. However, it would be nice if there was a way to do this if the assertions fail. For example, the following would include the request / response in the exception.

webTestClient.get()
   .url("/foo")
   .exchange()
   .assertStatus().isOk();

The following would also include the request / response in the assertion (possibly with a new assertion exception that contains the original exception as a caused by)

webTestClient.get()
	.uri("/users")
	.exchange()
	.andAssert( info -> { 
		assertThat(info.getResponse().statusCode()).isEqualTo(HttpStatus.OK);
	});

Referenced from: commits 2435820

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 13, 2017

Rob Winch commented

Assigning to Rossen Stoyanchev since we discussed this already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants