WireMock for Java Developers
Learn to build robust RESTFUL API Clients, Service Virtualization in Java and SpringBoot applications using WireMock.
Created by Dilip Sundarraj, Last Updated 24-Oct-2019, Language:English
WireMock is a simulator for HTTP-based APIs or MockServer.
REST APIs are everywhere today as it's the modern and easiest way to build functionality and expose it to the real world.
When it comes to writing Unit Test Cases that involve REST-based interactions there is always a challenge in testing error responses, network faults, latency, and timeouts. WireMock is going to solve this problem of the application code that depends on the external service by mocking the actual service.
In MicroServices Architecture, It is pretty common for services to depend on one other and it's always a challenge to write test cases for the code that depends on other external services. WireMock provides the necessary tools to simulate an external service so the code that depends on the external service can be tested which helps to build the robust REST Client.
This course is going to cover the techniques that are listed below using WireMock:
Simulating the External Service
Simulating Error response
Simulating Network errors
Learn to integrate the most powerful HTTP Mock library - WireMock into your application to build a Resilient and Robust REST API clients.
Why you should use WireMock ?
If your application depends on an API that does not exist but still you would like to build the REST Client then WireMock can help support that kind of development.
If you would to cover all the edge cases scenarios such as NetWork Errors, Faults, Latency andRunTime Exception in your REST Client then start using WireMock
If you would like to write Unit Test cases that covers all the possible scenarios that can happen in a REST based interaction then start using WireMock.
In a MicroServices Architecture it is pretty common for your services to depend on other. WireMock is a powerful simulation tool to simulate the service that your application depends on it. In a nutshell, WireMock is a Service Virtualization tool.
What's Covered in this Course?
Introduction to WireMock
Learn to build REST Client using the Spring WebClient.
Learn to virtualize an External Service
Learn to create Stubs using WireMock
Learn to Simulate Network Errors, Latency, Network Timeouts and more.
Learn to run WireMock using JUnit4 and JUnit5 platform
Learn to integrate and run WireMock in Spring Boot application
- Experience working with Java applications
- Java 8 or Higher
- Knowledge of building RESTFUL API Clients
- Knowledge of RESTFUL API
- Experience working with Gradle/Maven
- Experience working with Intellij, Eclipse etc.
What Will I Get ?
- This course will help the students to learn about “how to write unit tests” which involves RESTFUL API integrations.
- Mock an External Service using WireMock
- Build REST API Clients using Spring Webclient
- Write Unit Tests that covers all the possible scenarios in a REST based interaction
- Build a robust REST Client by simulating Network Errors
- Build a robust REST Client by simulating Network Latency
- Unit Test the timeout of the REST Client
Getting Started with Course
Course Introduction & ObjectivesPreview00:02:24
Introduction to WireMock
Why WireMock ?Preview00:07:32
What is WireMock ?Preview00:03:32
WireMock vs Mocking LibrariesPreview00:02:55
Build REST Clients using Spring WebClient - Hands On
Setting Up WireMock
Build Stubs Using WireMock - Hands On
Verifying the Stubs - Hands On
Simulating Server/Fault Responses - Hands On
Simulating Latency - Hands On
Selective Proxying - Hands On
Running WireMock on Junit 4
Running WireMock on Spring Boot - Hands On
Running WireMock with Spring Boot and JUnit5