Skip to content

Document how to use Spring REST Docs with the WebTestClient with Spring-Boot #741

@brneto

Description

@brneto

Where in the documentation I could present a example of using it with WebTestClient + Spring-Boot.
e.g.

@WebFluxTest
@AutoConfigureRestDocs
class ControllerTests {

    private WebTestClient webClient;

    @BeforeEach
    void setUp(
            @Autowired ApplicationContext context,
            @Autowired WebTestClientRestDocumentationConfigurer configurer) {

        webClient = WebTestClient
                .bindToApplicationContext(context)
                .configureClient()
                .filter(configurer)
                .entityExchangeResultConsumer(document("{class-name}/{method-name}"))
                .build();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions