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
4 answers

Unable to set wiremock server port

I am trying to configure wiremock port. Its always giving the below exception. I am using the latest version 2.8.0 version Exception in thread "main" org.apache.http.conn.HttpHostConnectException: Connect to localhost:8080 [localhost/127.0.0.1,…
vkrams
  • 7,267
  • 17
  • 79
  • 129
3
votes
3 answers

Wiremock Stubbing not working

I've just started using Wiremock and I have a question about stubbing. From the docs, it seems to be that you can use either a JSON file under mappings OR the code stubFor(get(urlEqualTo(... in your Java code. However, I'm finding that using…
angusrose
  • 143
  • 1
  • 3
  • 13
3
votes
1 answer

Android, WireMock.stubFor not return stub response

I want to return stub response when Android app send http request that contain /api/Profile/Favorite?value=%7B%22ID%22%3A11821%7D So here my test (using WireMock framework) @RunWith(AndroidJUnit4.class) public class ContactsFragmentTransportTest…
Alex
  • 1,857
  • 4
  • 17
  • 34
3
votes
1 answer

WireMock Performance and Load Testing

Is there any way to make WireMock Standalone faster? I have 1kb response file that I want to get back between 3ms - 10ms Currently the response is coming back within 20ms - 40ms This is for an individual request/response from SoapUI, so it also…
DawnFreeze
  • 164
  • 1
  • 3
  • 13
3
votes
0 answers

Groovy pollutes classpath with old servlet API

I'm writing a Groovy script to start WireMock server during our CI process: #!/usr/bin/env groovy @Grapes([ @Grab(group = 'com.github.tomakehurst', module = 'wiremock', version = '2.5.0') ]) import…
madhead
  • 31,729
  • 16
  • 153
  • 201
3
votes
2 answers

Correct placement of the stubs in Junit test class for wiremock

I found below code from here. All the stubs are created in @Before section. @Rule public WireMockRule wireMockRule = new WireMockRule(18089); private HttpFetcher instance; @Before public void init() { instance = new HttpFetcher(); // all…
prime
  • 14,464
  • 14
  • 99
  • 131
3
votes
1 answer

Can I specify a --proxy-all parameter to WireMock to match any web site when recording?

I am building a proxy service to record and play responses from the web using WireMock. I have recently discovered that these two modes are separate, so am attempting to build a small set of Docker containers to run these services in…
halfer
  • 19,824
  • 17
  • 99
  • 186
3
votes
1 answer

How to mock a java.net.Socket using wiremock?

I need to mock java.net.Socket class using wiremock technique... Is it possible to wiremock a Socket class?
Sat
  • 3,520
  • 9
  • 39
  • 66
3
votes
0 answers

wiremock - Update changes in json file even jar is running

I am new to WireMock and currently understanding standalone jar functionality. Is there any way that we can do changes in .json file which is under mapping folder and don't want to run jar again and again. i.e. to do changes in json files even when…
Manan Kapoor
  • 675
  • 1
  • 11
  • 28
3
votes
1 answer

Test asynchronous behavior using WireMock

I am using Akka actor system with Spray and WireMock for stubbing web services. I want to also verify that the external http request was already made. In the following use case a POST request is made to my Spray server which should send a request to…
mirelon
  • 4,896
  • 6
  • 40
  • 70
3
votes
2 answers

Adding headers to Jetty in Wiremock

I'm running into CORS issues using the Wiremock standalone jar. I call my mock service using jQuery ajax. Is it possible to add the required "Access-Control-Allow-Origin" header when starting up the server?
dex
  • 275
  • 1
  • 4
  • 10
2
votes
3 answers

Wiremock integration with spring boot is throwing 404 exception as "Request did not match as stub is not registered"

I have been using wiremock for integration testing with spring boot, getting 404 exception. With message as "Request did not match, as no stubs registered" I have tried with wiremock server and wiremock rule instance. Tried with Wiremock's JUnit…
2
votes
1 answer

Does WireMock support Mocking GraphQL APIs

We have multiple micro services which is based on GrapQL and few of them based on REST and each micro service will call multiple other microservices (Java, Spring Boot tech stack). Now we want to write integration testing for this kind of…
2
votes
1 answer

Wiremock stateful behavior doesn't work as expected with multiple scenarios

I have a test helper function createUser that makes an HTTP request to the backend API to create a user. The backend API calls a method on Auth0 client to create a user. The responses I have are set for Auth0 client URL path /api/v2/users. I am…
buterfly85
  • 163
  • 3
  • 11
2
votes
2 answers

How to verify a wiremock service get some calls

I am doing a functional testing of a service A. The function is triggered by an api call 1 from service B and then at last respond (send another api call 2) to the service B. Therefore, the plan is to wiremock the service B and make a call 1 and…
Laodao
  • 1,547
  • 3
  • 17
  • 39