WireMock for Java Developers
Created by Dilip Sundarraj, Last Updated 24-Oct-2019, Language:English
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
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
Requirements
- 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.
Description
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:
Service Virtualization
Simulating the External Service
Simulating Latency
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
Course Content
-
Getting Started with Course
2 Lectures 00:03:09-
Course Introduction & Objectives
Preview00:02:24 -
Pre-Requesities
Preview00:00:45
-
-
Introduction to WireMock
3 Lectures 00:13:59-
Why WireMock ?
Preview00:07:32 -
What is WireMock ?
Preview00:03:32 -
WireMock vs Mocking Libraries
Preview00:02:55
-
-
Build REST Clients using Spring WebClient - Hands On
11 Lectures 01:18:26-
Setting up the Movies App
00:04:42 -
RestTemplate vs Spring WebClient
00:02:31 -
Setting up the Movies Domain
00:03:49 -
Build Movies REST Client using Spring WebClient
00:05:55 -
Build Movies REST Client test using JUnit5
00:05:30 -
WebClient - Retrieve Movie by Movie-ID
00:12:00 -
WebClient - Retrieve Movie by Movie-Name
00:09:06 -
WebClient - Retrieve Movie By Year
00:06:57 -
WebClient - Add a new Movie -HTTP POST
00:10:36 -
WebClient - Update a Movie - HTTP PUT
00:09:08 -
WebClient - Delete a Movie - HTTP DELETE
00:08:12
-
-
Setting Up WireMock
1 Lectures 00:03:59-
Configuring WireMock
00:03:59
-
-
Build Stubs Using WireMock - Hands On
14 Lectures 01:11:37-
Overview
00:01:06 -
Create the very first Stub
00:08:35 -
How WireMock works Behind the scenes and Matches the Stub?
00:03:41 -
URL Matching Stub - urlPathEqualTo()
00:05:15 -
URL Matching Stub using urlPathMatching()
00:05:10 -
Generate Dynamic Http Response using ResponseTemplateTransformer
00:05:51 -
Stub with 400 HttpStatus as Response
00:04:16 -
Stub matches a Query Param using urlEqualTo()
00:06:36 -
Generate Dynamic Response Stub by reading Query Param from the request
00:02:57 -
Stub with RequestBody - HTTP POST
00:08:14 -
Dynamic Response Stub - HTTP POST
00:05:56 -
Stub with 400 Bad Request Response - HTTP POST
00:03:09 -
Stub for HTTP PUT
00:06:04 -
Stub for HTTP Delete
00:04:47
-
-
Verifying the Stubs - Hands On
2 Lectures 00:11:22-
Why Verify the Stubs?
00:05:59 -
Explore the verify DSL
00:05:23
-
-
Simulating Server/Fault Responses - Hands On
3 Lectures 00:11:47-
Introduction to Server/Fault Responses
00:01:40 -
Simulating 5xx Response
00:05:58 -
Simulating Fault Responses - Network Errors
00:04:09
-
-
Simulating Latency - Hands On
2 Lectures 00:09:26-
Configuring read/write Timeout - Spring Webclient
00:05:13 -
Simulating Latency
00:04:13
-
-
Selective Proxying - Hands On
2 Lectures 00:06:25-
What is Selective Proxying ?
00:01:24 -
Simulating Selective Proxying
00:05:01
-
-
Running WireMock on Junit 4
2 Lectures 00:07:43-
WireMock on JUnit4
00:02:00 -
Run WireMock on JUnit4
00:05:43
-
-
Running WireMock on Spring Boot - Hands On
4 Lectures 00:22:51-
Overview and Project SetUp
00:04:30 -
Building the Client Code
00:05:08 -
Run WireMock on Spring Boot using @AutoConfigureWireMock - Approach 1
00:09:57 -
Run WireMock on Spring Boot using WireMockRule- Approach 2
00:03:16
-
-
Running WireMock with Spring Boot and JUnit5
3 Lectures 00:13:47-
Configuring Spring Boot for JUnit5
00:03:09 -
Run WireMock with Spring Boot and JUnit5
00:05:20 -
Run WireMock with Spring Boot/JUnit5 using WireMockExtension
00:05:18
-