-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Document how to parameterize output directory for REST Docs with WebTestClient #27755
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
Conversation
|
@brneto Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
|
@brneto Thank you for signing the Contributor License Agreement! |
|
@wilkinsona It failed with message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for the PR, @brneto. I've left a couple of comments for your consideration when you have a moment.
spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testing.adoc
Outdated
Show resolved
Hide resolved
spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testing.adoc
Outdated
Show resolved
Hide resolved
That's not a failure. It's just indicating that it couldn't publish a build scan to |
|
I'm still intrigued why this doesn't work: @WebFluxTest
@AutoConfigureRestDocs
abstract class ContractTest {
@TestConfiguration(proxyBeanMethods = false)
static class RestDocsParameterizedOutput {
@Bean
WebTestClientBuilderCustomizer restDocsParameterizedOutput() {
return builder -> builder.entityExchangeResultConsumer(document("{class-name}/{method-name}"));
}
}
@Autowired
private WebTestClient webTestClient;
void webTestClientSetup() {
RestAssuredWebTestClient.webTestClient(webTestClient);
}
}While this does: @WebFluxTest
@AutoConfigureRestDocs
abstract class ContractTest {
@Autowired
private ApplicationContext context;
@Autowired
private WebTestClientRestDocumentationConfigurer configurer;
void webTestClientSetup() {
RestAssuredWebTestClient.webTestClient(
WebTestClient
.bindToApplicationContext(context)
.configureClient()
.filter(configurer)
.entityExchangeResultConsumer(document("{class-name}/{method-name}"))
.build());
}
}Any thought why this is happening? Thanks! |
|
@wilkinsona I've just figured out why this is happening! That's because the tests generated by the Spring Contract Test does not have the |
|
@wilkinsona It worked externalising the @WebFluxTest
@AutoConfigureRestDocs
@Import(ContractTestConfiguration.class)
abstract class ContractTest {
@BeforeEach
void webTestClientSetup(@Autowired WebTestClient webTestClient) {
RestAssuredWebTestClient.webTestClient(webTestClient);
}
} |
|
@wilkinsona is there anything else I have to do or this is it for this PR? Do you know why this |
|
It's failing because the code in |
|
Let me fix that. Give me a sec. |
|
@wilkinsona, just did ae79b33. Sorry for that! :( |
|
@wilkinsona it's still failing! Have I made any other mistake? :( |
...onfiguredspringrestdocs/withwebtestclient/MyWebTestClientBuilderCustomizerConfiguration.java
Outdated
Show resolved
Hide resolved
|
@brneto Just a small checkstyle violation. You can push another commit to fix that, or as Andy said we're happy to fix it when merging. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@brneto Thanks very much for making your first contribution to Spring Boot. |
closes #27747