Questions tagged [mockserver]

What is MockServer

MockServer can be used for mocking any system you integrate with via HTTP or HTTPS (i.e. services, web sites, etc).

MockServer can:

  • return a "mock" response when a request matches an expectation

  • forward a request when the request matches an expectation (i.e. a dynamic port forwarding proxy)

  • execute a callback when a request matches an expectation, allowing the response to be created dynamically

  • verify requests have been sent (i.e. as a test assertion)

What is MockServer Proxy

MockServer Proxy can be used for transparently recording all requests sent by a system (i.e. an application or set of applications).

MockServer Proxy can:

  • proxy all requests using any of the following proxying methods:

    • Port Forwarding
    • Web Proxying (i.e. HTTP proxy)
    • HTTPS Tunneling Proxying (using HTTP CONNECT)
    • SOCKS Proxying (i.e. dynamic port forwarding)
  • verify requests have been sent (i.e. in a test assertion)
  • record requests and responses to analyse how a system behaves
175 questions
4
votes
2 answers

How to use MockRestServiceServer with multiple URLs?

I need to configure multiple expectations on an instance of MockRestServiceServer. The expectations are for two different URLs: Call URL #1 Call URL #1 (for a second time) Call URL #2 The same URL is called twice, then a 3rd call is made to the…
Jeff Hall
  • 41
  • 1
  • 4
3
votes
2 answers

How do I create a mock api based on multiple Open API specifications?

I have been trying to wrap my head around mock api services, such as the one that Stoplight provides. I want to create something similar, but I keep hitting a wall and I can't imagine why it should be so hard to figure out. Here's the…
jezzdk
  • 31
  • 1
3
votes
1 answer

MockServer. Verify call happends within x seconds

I am trying to write an integration test using MockServer (https://www.mock-server.com) and I would like to verify that a request was called on the mock after running the asynchronous anAsyncMethodThatReturnsImmediatly() method on the tested class…
Bentaye
  • 9,403
  • 5
  • 32
  • 45
3
votes
1 answer

How make request to MirajeJS js only when I need it

I have a fake server created with mirajeJs. All my requests are trying to contact him, how can I make a request for mirajeJs only in cases when I need it while making the rest of the requests to the real server
3
votes
2 answers

MockServer: Mocking external http/https response refuses connection on 80/443

What I was trying to achieve is mocking the response of google oauth2 endpoint. Here is my setup: # docker-compose.yml version: '3.8' services: busybox: image: yauritux/busybox-curl:latest command: tail -f /dev/null networks: -…
nTOXIC
  • 143
  • 2
  • 12
3
votes
1 answer

how to design dynamic response in mock server

I'm now using the mock server from https://www.mock-server.com/ and run it in a docker container. Now I would like to let the response change as request body changes. I've looked up for dynamic response on official webiste for a while, but have no…
roihn
  • 31
  • 1
  • 2
3
votes
1 answer

MockServer and OkHttp: body type missmatch (json vs string)

Hi Stack Overflow community! I'm trying to mock a microservice in some java integration tests. To do so, I'm using MockServer version 5.5.1. To do the rest-requests I'm using OkHttp version 3.13.1 The code in java: final SomeDTO requestObject = new…
Thomas Stubbe
  • 1,945
  • 5
  • 26
  • 40
3
votes
0 answers

Is it possible to use session variable in SoapUI

I have implemented a mock service.it mock a async soap web service with call back result.When a request arrive with a unique id, mock service provide a response ("Prossesing") and store the requestid in a context like this (within…
mnhmilu
  • 2,327
  • 1
  • 30
  • 50
2
votes
1 answer

Setting mock ports for multiple providers in pact-jvm

I am trying to learn the pact framework by rewriting some of our wiremock tests that test our application written in java and springboot. I have provided a simplified example of where we end up getting…
Kevin de Boer
  • 115
  • 1
  • 2
  • 4
2
votes
0 answers

Certificate Chain does not work in mockserver

I would use a Certificate Chain (multiple PEM file merged in one file - end-entity certificate + Intermediate certificate) to do server authentication. I'm using the following env variable: MOCKSERVER_TLS_X509_CERTIFICATE_PATH pointing to a file…
Riccardo Califano
  • 1,317
  • 3
  • 10
  • 19
2
votes
0 answers

MbTest(MounteBank) vs WireMock vs Mock-server vs anyother for encrypted payload

we need to decide a mock-server for our applications. We have an ask in which the applications sends encrypted payload in request and response . that encryption is using rsa so the encrypted string changes for same payload so it is not possible to…
2
votes
1 answer

MockServer throws "Connection refused" while SpringBootTest

I just can't get the org.mock-server running. It gives me: org.mockserver.client.netty.SocketConnectionException: Unable to connect to socket localhost/127.0.0.1:443 Here is the code of my test case: private ClientAndServer…
k-wasilewski
  • 3,943
  • 4
  • 12
  • 29
2
votes
0 answers

Wiremock/Mockserver with custom Domain Name?

I'm trying to do a test where my client allows the use of wildcard certificates (ie. CN=*.dev.domain). I'm trying to setup a mock server that has this certificate in its keystore, but I need to customize the mock server's domain into something like…
John
  • 81
  • 4
2
votes
1 answer

SAPUI5 JSON REST API (non-oData) mock server

How is it possible to use a mock server for JSON REST API and not for a oData service? I would like to mock http://localhost:8080/api/v1/configs to get a JSON list of all configurations even if I have no backend connection and I am running the app…
Nico S.
  • 116
  • 6
2
votes
1 answer

How to implement a JUnit test for mutual TLS authentication?

My Spring Boot application is connecting to third parties servers using a third librabry/framework. One of these remote servers (not yet available) will require mutual TLS (HTTPS) connection. My code will provide the P12 and password to the…
ThierryC
  • 1,794
  • 3
  • 19
  • 34
1
2
3
11 12