WireMock JUnit 5 Test Setup For Integration Tests

YouTube series explaining how to use WireMock for mocking the HTTP communication to external systems for integration tests.

With this last video lesson, we’ll take a look at the WireMock test setup for JUnit Jupiter (part of JUnit 5).

While the sample application uses Spring Boot, you can use this testing recipe for any Java application.

JUnit 5 community extensions:
https://github.com/JensPiegsa/wiremock-extension
https://github.com/phxql/wiremock-junit5
https://github.com/lanwen/wiremock-junit5

Status of the official JUnit 5 WireMock extension: https://github.com/tomakehurst/wiremock/issues/684

Content:

0:00​ Current State of WireMock’s JUnit 5 Support
2:45 Alternative to Using an Extension
3:55 Implement the ApplicationContextInitializer
07:40 Register the ContextInitialier for our Test
08:38 Writing the First Test
10:52 Recap of the WireMock Series
12:10 Further Spring Boot Testing Tips & Tricks

Part I: https://youtu.be/aANqNIY2IjY
Part II: https://youtu.be/pji3EJQ8UUc
Part III: https://youtu.be/kj4rqvFASdw
Part IV: https://youtu.be/aeioeXjiz2Y

The source code for this video is available on GitHub: https://github.com/rieckpil/blog-tutorials/tree/master/spring-boot-integration-tests-wiremock

30 Testing Tools and Libraries Every Java Developer Must Know: https://rieckpil.de/testing-tools-and-libraries-every-java-developer-must-know/

» Testing Spring Boot applications deep-dive: https://rieckpil.de/testing-spring-boot-applications-masterclass/

#wiremock #junit #junit 5

WireMock JUnit 5 Test Setup For Integration Tests