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
0
votes
1 answer

mock-server: How to delete the expectation

I have a expectation created in mock-server { "httpRequest": { "method": "GET", "path": "/view2/id", "queryStringParameters": { "id": [ "1021901022" ] } }, "httpResponse": { "statusCode": 200, …
jprism
  • 3,239
  • 3
  • 40
  • 56
0
votes
0 answers

mock-server running as war inside Tomcat

I am running Tomcat 10.1.6 and deployed mockserver-war-5.15.0.war. I get the following exception Exception jakarta.servlet.ServletException: Class [org.mockserver.mockservlet.MockServerServlet] is not a Servlet …
jprism
  • 3,239
  • 3
  • 40
  • 56
0
votes
0 answers

How to use custom certificates in MockServer SSL context?

There is a Java unit test using MockServer. For failed SSL handshake emulation I intend to use a certain certificate: an instance of a class extending java.security.cert.Certificate. I tried to find something in the docs, but it only describes how…
diziaq
  • 6,881
  • 16
  • 54
  • 96
0
votes
1 answer

How to get request body from from mock-server.org

I am planning to use mock server from mock-server.org for a cypress project. Is there any way to get requests body from the server so I can validate the schema and the content?
0
votes
0 answers

Unable to use Mustache template with Mockserver alternate response

I have a MockServer 5.14.0 (Netty) application running as a Docker container. I'm trying to setup an expectation that based on a given GET request by identifier, if the resource exists, return the dataset available for the same, otherwise a…
x80486
  • 6,627
  • 5
  • 52
  • 111
0
votes
1 answer

MockServer with test specific session id

I use SpringBoot and Java to write e2e tests for my API. Along the flow, I am doing an HTTP call to a storage API (S3), and I am mocking it using MockServer. This is the HttpClient and how I am creating my post request: public class HttpClient { …
0
votes
0 answers

how to return a response from mock server and save it to a variable

'hi team,' 'if the response is dependent on request how to handle in castle mock server ?' 'for example: if the order number is 1000 then the response should be as shown in bellow 1) else' if the order number is 1001 then the response should be as…
0
votes
0 answers

Unable access dyson mock server endpoints after deploying the app to a server

I have implemented a dyson mock server in my react project , i have followed below ref Example for dyson mock server implementation when i run the project i am able to access the endpoints which i have implemented using dyson on localhost but i…
iamro45
  • 1
  • 2
0
votes
3 answers

How to Mock Post request with multi part form body

I need to mock a post request with multipart form body as given below. I tried with a regex pattern for the unique string in the body --Z5KfGboCdJvPl4VsEq74AeK7PZN4EyN , but it didn't work. Can some one guide me on this? BODY…
0
votes
1 answer

Expectation Initializers with mockserver java not load

I use mockserver (mock-server) on my java project and now I want to start it with a persistent Expectation Initializers with the mvn command. I tested it with a json file and it work correctly, but when I use or rather start it with an Expectation…
furyo
  • 13
  • 2
0
votes
1 answer

MockServer monitoring using Grafana

Is there any solution to monitor MockServer with grafana using HTTP PUT request? I tried using BlackBox exporter but it doesn't send proper data to grafana. I need to get only the HTTP status of MockServer (200, 404, etc.)
0
votes
1 answer

How to run mock server tests in isolation?

I have these two mock server tests. When I launch these, the second test fail because the two tests are not launched in isolation. The mocking of the HTTP call in the first method isn't override in the second…
Julien Gavard
  • 613
  • 1
  • 6
  • 20
0
votes
1 answer

Exact matching for headers with MockServer

I use MockServer to test my application and I need the request definition to match only if the exact headers set was matched, i.e. there are no missing nor extra headers in the request. Using this Kotlin code it matches any request that contains at…
Ultranium
  • 332
  • 2
  • 19
0
votes
0 answers

Testing Apache HttpAsyncClient retry strategy

I am missing something in retry mechanism of HttpAsyncClient. I'm trying to test the retry strategy using Mockito and Mock Server. I've created a simple snippet of code to test it with a client using the DefaultHttpRequestRetryStrategy with 4…
Gilberto T.
  • 358
  • 6
  • 19
0
votes
1 answer

How to fix SocketTimout execction on mockserver

I want to use mockserver to mock requests and responses. For that, I am using the mockserver docker image. Following is then the docker-compose file example where use mockserver. mockServer: image: mockserver/mockserver container_name:…
keepmoving
  • 1,813
  • 8
  • 34
  • 74