Are you tired of writing tests which have a lot of boilerplate code? If so, get started with Spock Framework >>

WireMock Tutorial

This tutorial helps you to get started with WireMock and describes how you can use it when you are writing automated tests with JUnit 5.

This tutorial assumes that you are familiar with JUnit 5. Also, keep in mind that this tutorial is a work in progress.

This tutorial consists of the following blog posts:

  • Introduction provides a quick introduction to WireMock. After you have read this blog post, you can identify the key features WireMock, you understand when you should use it, and you can get the required dependencies with Maven and Gradle.
  • Configuration describes how you can configure WireMock from the scratch. After you have read this blog post, you can configure the used WireMock server, you know how you can start the WireMock server before a test method is run, and you can stop the WireMock server after a test method has been run.
  • Request Matching, Part One provides an introduction the request matching support of WireMock. This blog post helps you to understand how request matching works, and describes how you can specify expectations for request methods and request urls.
  • Request Matching, Part Two describes how you can use the WireMock’s request matching support when you want specify expectations for cookies, HTTP headers, and request parameters.
  • Request Matching, Part Three describes how you can specify expectations for the JSON document that is received by your WireMock server.
  • Request Matching, Part Four describes how you can specify expectations for the XML document that is received by your WireMock server.
  • Introduction to Stubbing describes how you can ensure that your WireMock server returns a configured HTTP response when it receives a specific HTTP request.