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
1
vote
1 answer

How to make some setup work before ApplicationEvent listener in test

I have a customized spring-boot-starter which will call some REST APIs when it gets a spring application event of ApplicationReadyEvent, so the configuration class is something like: @Configuration public class MySpringBootStarter { …
Tonny Tc
  • 852
  • 1
  • 12
  • 37
1
vote
2 answers

queryStringParameters in mock-server

I have the following…
Limbo
  • 623
  • 8
  • 24
1
vote
0 answers

Overloaded method value withBody with alternatives error mockserver in scala

I am trying to use mockserver to mock an API for testing. I am creating expectations using this: import org.mockserver.model.ParameterBody._ import org.mockserver.model.Parameter._ ... mockServer .when( request() …
Selnay
  • 699
  • 4
  • 16
1
vote
2 answers

Need a mock server for my custom HttpClient rest template to test with

I have a custom authentication rest template my library returns which is HttpClient. I need a library that will let me bind my rest template to the mock server so I can test my template. I had high hopes for TestServer in .Net Core but it has…
Puerto
  • 1,072
  • 3
  • 11
  • 32
1
vote
1 answer

Mockserver maven plugin: init mockserver expectations from file

I'm using Mockserver maven plugin to mock some requests for integration tests. My pom.xml looks like: ... org.mock-server mockserver-maven-plugin
italktothewind
  • 1,950
  • 2
  • 28
  • 55
1
vote
1 answer

How to return a response from Mock-Server and save it to a variable?

I am new to API Testing and do not understand mocking responses from API calls so any help would be appreciated. I have searched for the information online and nothing much is available, it seems except for the mock-server documentation which I am…
curiousTester
  • 121
  • 1
  • 12
1
vote
2 answers

Sinon fakeServer failed to mock POST: 'TypeError: By RFC7230, section 3.2.4, header values should be strings. Got object'

GET method works fine, but always get trouble with POST. my test code is let server = sinon.createFakeServer(); server.respondImmediately = true; server.respondWith(`api/v1.0/companies/${companyResponse.id}/orgchart`, [200, {"Content-Type":…
1
vote
1 answer

How to setup hosting for Multiple mock services using Karate DSL , which will be hosted for long

We have lot many vendors and not all have sandboxed environments made available to test integration. I was looking to mock them and thus would host them myself, we are using karate extensively as our BDD tool. How can multiple mock services be…
Amit Vyas
  • 103
  • 2
  • 8
1
vote
0 answers

Issue adding PATCH to CORS with jamesdbloom/MockServer

I am having difficulty adding the method PATCH to MockServer. I use the curl request below and the expectation is created properly. While testing I receive the following error. Method PATCH is not allowed by Access-Control-Allow-Methods in preflight…
whoacowboy
  • 6,982
  • 6
  • 44
  • 78
1
vote
1 answer

AssertionError while executing JUnit test case

I am executing a JUnit test case to test the service. And I am facing java.lang.AssertionError while running the test case. Given below is the test class and the url builder piece of code. @Test public void testSuccess() throws Exception { …
Poonkodi Sivapragasam
  • 1,127
  • 4
  • 18
  • 27
1
vote
1 answer

How to setup Mock Server to Test iOS and Android app

I have a mobile application running on iOS and Android, I need to create my functional Automated test cases, however for some scenarios I need specific data , so I think a mock server can help on this. I'm not sure how to start with that as I never…
Sandra
  • 105
  • 1
  • 11
1
vote
1 answer

Cookie usage for MockServer in parallel tests

I am trying to run multiple tests in parallel and I need to obtain independent responses for each request made through MockServer. I am using the gem https://github.com/jamesdbloom/mockserver-client-ruby for the following request: def…
1
vote
1 answer

Mockserver: callback once request is received

I'm using Mockserver to test an HTTP service that produces side-effects asynchronously. Let's say for example, I'm testing ServiceA that exposes an HTTP API method at /api/status/{id}. Separately from returning the status result to the caller of the…
Nate Vaughan
  • 3,471
  • 4
  • 29
  • 47
1
vote
2 answers

UI5 Mock Server with Local Data: "rootUri" Not Working

I'm currently following the UI5 tutorial and am stuck on step 27: Mock Server Configuration. The problem is the rootUri configuration of the mock server. I am using the Northwind OData service as per tutorial and have configured a dataSource for…
Daniel Kneip
  • 13
  • 1
  • 5
1
vote
1 answer

mockserver-grunt Error spawn java ENOENT

I am trying to start a mockserver-grunt using node modules. My problem is that the following error occurs: events.js:160 throw er; // Unhandled 'error' event ^ Error: spawn java ENOENT at exports._errnoException (util.js:1022:11) at…
Dianna
  • 402
  • 1
  • 4
  • 15