Questions tagged [wiremock]

Library used for stubbing and mocking web services.

Wiremock is a library written in Java by Tom Akehurst. It is used for stubbing and mocking web services. It supports HTTP response stubbing, request verification, proxy/intercept, record/playback of stubs and fault injection, and can be used from within a unit test or deployed into a test environment.

For more information see http://wiremock.org

894 questions
4
votes
1 answer

How to use WireMock to mock an upstream service with Protobuf (gRPC) response

I am writing integration tests for my Java Service. We are thinking of using WireMock to mock upstream services. However, one of our upstream returns a Protobuf (grpc) response and I can't seem to understand how to mock a gRPC response using…
StyleBender
  • 41
  • 1
  • 2
4
votes
1 answer

Seperate wiremocks QuarkusTestResources

In my Quarkus application I have multiple controllers which use multiple rest clients. I have multiple tests which all use a @QuarkusTestResource with a Wiremock resource. My approach was for each controller to have it's own Wiremock resource and…
KOT
  • 1,986
  • 3
  • 21
  • 35
4
votes
2 answers

Wiremock templating fixedDelayMilliseconds

I am trying to generated a response in wiremock, after a delay, where that delay is derived from the incoming request. e.g the family-name of the user in the request is "delay_10000" then delay by 10000 milliseconds, or delay_20000 then delay by…
4
votes
0 answers

How to configure WireMock to load/save StubMappings to AWS S3?

I am trying to use WireMock's Record and Playback feature but with the difference that I want all the Stub Mappings to be saved to S3 and then load it back. I wrote a custom S3MappingSource that implements MappingsSource: public class…
daltonfury42
  • 3,103
  • 2
  • 30
  • 47
4
votes
1 answer

Trying to use MockMvc together with Wiremock

I'm trying to make a mockMvc call run together with wiremock. But the mockMvc call below in the code keeps throwing 404 instead of the expected 200 HTTP status code. I know that wiremock is running .. I can do http://localhost:8070/lala through…
user12685763
4
votes
1 answer

Use wiremock to intercept a POST request in order to check it's query params

Is it possible to have a test using Wiremock for a known POST request, in order to check the query params the request has? wireMockServer.start(); stubFor(post(urlMatching("http://localhost:8080/smth.*")) .withHeader("Content-Type",…
Alex
  • 65
  • 8
4
votes
1 answer

java.lang.NoSuchFieldError: INSTANCE in try to run WireMockServer

I want to mock https calls in my Robolectric tests using wiremock, but when I run tests I guess the problem is about dependencies, but I have no idea how to resolve it. I tried to exclude httpclient from wiremock dependency, and use…
4
votes
6 answers

Wiremock Date format

I want to generate date in the format 2019-03-28T15:30:59+12:00 using wiremock. I tried: "currentDateTime": "{{now timezone='Australia/Sydney' format='yyyy-MM-dd'T'HH:mm:ssZ'}}" but, I get…
Rajkishan Swami
  • 3,569
  • 10
  • 48
  • 68
4
votes
2 answers

XML Matching with Wiremock

I'm setting up a dummy PHP server with wiremock and want to match based upon one of the XML fields being passed. I basically will have multiple requests coming into this same url but the main difference between them will be the invoice number. My…
jwolsborn
  • 576
  • 1
  • 6
  • 26
4
votes
1 answer

Response Templating for a Static Json File

I am using WireMock in java to stub for a POST request. The request returns a json body file that is stored in my local. The stub looks like this: wireMockServer.stubFor(get(urlMatching("/v1/invoices/.*")) .willReturn(aResponse() …
Rayan Ahmed
  • 165
  • 2
  • 11
4
votes
1 answer

StreamRetryTemplate for Spring Cloud Streams not retrying in integration tests

We are utilizing Spring Cloud Streams that listen to a Kafka topic and call a rest service. We also implement a custom StreamRetryTemplate to specify what kind of errors we deem recoverable and which we do not. I cannot get consistent results…
4
votes
1 answer

java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier

Android Studio 3.3 I want to use WireMock in my Espresso tests. build.gradle: buildscript { ext.KOTLIN_VERSION = '1.3.21' ext.ESPRESSO_VERSION = '3.2.0-alpha02' repositories { google() jcenter() } dependencies { …
Alexei
  • 14,350
  • 37
  • 121
  • 240
4
votes
0 answers

Android: Espresso: Can't run Espresso test with WireMock - org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures

Can't build android proejct with WireMock lib Android Studio 3.2, Android 6.0 I want to add WireMock in my Espresso test. app/build.gradle android { dataBinding { enabled = true } compileSdkVersion 28 defaultConfig { …
Alexei
  • 14,350
  • 37
  • 121
  • 240
4
votes
0 answers

Spring Cloud Wiremock doesn't pick transformers from JSON file during tests

With the following setup, spring doesn't pick a transformer defined in JSON file which is under mappings directory, but it does when I declare it directly in test code. @Configuration public class WiremockConfiguration { @Bean …
Kamil W
  • 2,230
  • 2
  • 21
  • 43
4
votes
1 answer

Dynamically return a file based on query argument

I have this stub defined within my mappings directory. I'm trying to return a file dynamically based upon the value of my query parameter (the query param and file name will have the same name) Please see below an example. { "request": { …
Akif Tahir
  • 171
  • 3
  • 14