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
3
votes
3 answers

How to mock couchbase for acceptance testing without embedded server or a new cluster just for that?

I'm doing acceptance testing for a microservice that connects to couchbase, elasticsearch and Kafka. I don't want to use any embedded instance or any test cluster. I want to be able to mock the couchbase calls, but at the same should test the N1QL…
varshavp27
  • 167
  • 1
  • 1
  • 14
3
votes
1 answer

Spring Cloud Contract - Query Parameter contracts always matches to the same contract

I am working on spring cloud contract and have a use-case where I want the response to be BAD_REQUEST when a few query parameters are missing and OK when all the mandatory query parameter are present. In order to achieve this, I have different…
3
votes
1 answer

How can I launch WireMock for XCTest UI tests under Xcode 10 and macOS 10.14?

We are using a standalone wiremock instance as a mock server for our Xcode UI tests. We have an test observer class which is responsible for spinning up this instance (if required) and tearing it down upon completion of the test run. The code for…
RehcsifMit
  • 270
  • 1
  • 13
3
votes
2 answers

Is wireMock.Net able to handle json files from folders under "__admin/mappings" directory?

I've developed a project using asp.net core 2.0 + wiremock.net. Currently, I'm able to handle json files under "__admin/mappings" directory only. However, I have several json files and because of that, I'd like to add one more folder under the…
3
votes
1 answer

How to read mapping and response files from disk

I deploy WireMock as a single WAR to my server. I followed the provided sample-war project to make my WAR works. That was very useful, so thanks for this example. The only one problem with my app is that WireMock reads mapping and configuration…
zappee
  • 20,148
  • 14
  • 73
  • 129
3
votes
1 answer

Evaluate an expression that returns a boolean value in Wiremock - Request matching criteria

Trying to use Wiremock as a tool for virtualizing SOAP services. The request mapping criteria looks something like below:- Mapping Criteria: {   "request":{     "method":"POST",     "urlPattern":"/myServices/mycontent.asgx", …
Monnie_tester
  • 439
  • 1
  • 6
  • 20
3
votes
2 answers

Wiremock request matching - Cannot match url with dynamic path variable when used with WireMockRestServiceServer

Stub mapping { "request": { "method": "GET", "urlPathPattern": "/validation/session/([a-zA-Z0-9/-]*)" }, "response": { "status": 200, "jsonBody": { "isIpBlocked": "Y", …
Thiagarajan Ramanathan
  • 1,035
  • 5
  • 24
  • 32
3
votes
2 answers

Wiremock - How can I apply response templating to the header name?

I am trying to provide a MOCK service that takes a headerName and value from the query and returns it as a (dynamic) header with the response. I am using the following response definition: "response" : { "status" : 200, "statusMessage": "OK", …
A. Fuss
  • 31
  • 1
  • 3
3
votes
2 answers

Wiremock returning wrong content-type for Spring Cloud Contract stub runner

I'm trying out Spring-Cloud-Contract for the first time. I'm trying to have my client auto-discover the contract stubs, but even though my contract specifies a content-type of 'application/json' on the response, what I get from WireMock has a…
Roddy of the Frozen Peas
  • 14,380
  • 9
  • 49
  • 99
3
votes
3 answers

How to use "Priorities" in wiremock

I want to understand how priorities work. More specifically, what is the expected output of setting priorities to stub. There's limited documentation on this and the ones available doesn't really explain what the output would look like so I'm unable…
Matt
  • 161
  • 1
  • 6
  • 17
3
votes
2 answers

Wiremock: choose body file name based on request parameter

I am using wiremock to mock http server and I am returning responses from json files (using withBodyFile method). Now I want to choose and return response json file based on request parameter. For the example below, I want to define one stub so that…
Kumar Gaurav
  • 729
  • 3
  • 9
  • 21
3
votes
1 answer

How to match exact json in wiremock for JUNIT

I am using wiremock for mocking rest service for Junit in Spring boot application. My problem is, i am not able to match multiple match patterns. Junit.java StringValuePattern pattern =…
3
votes
1 answer

Wiremock.net not responding in unit tests

I have been playing a little with Wiremock.net for mocking out HTTP calls. I've got it working happily running from a console application, but when I try to do it with a unit test it stops responding. Here is my complete code: FluentMockServer…
Chris Surfleet
  • 2,462
  • 4
  • 28
  • 40
3
votes
1 answer

Xpath validation wiremock matchesXPath expression

I am creating cases with Wiremocks and I am generating a response mock. I have a XML request like this:
dani77
  • 199
  • 2
  • 5
  • 26
3
votes
1 answer

import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig - Cannot resolve symbol 'core'

Keep getting this error on IntelliJ Cannot resolve symbol 'core' for the following import import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig Not entirely sure why. The following code also shows an…
Mohammad
  • 134
  • 2
  • 10