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

How to return custom object with byte array field using MockServer?

I am using MockServer org.mock-server mockserver-netty 5.10.0 I'd like to return custom object with which contain many…
TuGordoBello
  • 4,350
  • 9
  • 52
  • 78
2
votes
2 answers

Standalone MockServer: Where do I implement expectations?

I am trying to mock an external (REST) server used by my system under test. I am choosing MockServer (http://www.mock-server.com/) for mocking the external REST server. I am running mock server standalone as in: $ java -jar…
2
votes
1 answer

how to retrieve accented characters on express?

I have problems with accented characters on my POST request .. I tryed with iconv but noways.. Part of my code: Edit: ... var bodyString = JSON.stringify(req.body); var options = { host: XXXXX, port: XXX, path:…
2
votes
3 answers

Run Mock Server in standalone with Expectations

I am able to run Mock Server using command line with Java, but I am not able to find a way to pass an Expectation for it. java -jar mockserver-netty-3.10.4-jar-with-dependencies.jar -serverPort 1080 I know that with Maven plugin it may be possible,…
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
1
vote
0 answers

Return a dynamic response in Mock-server

I am working with https://www.mock-server.com/ and I've set my expectations in JSON format. I would like to fetch a field from request body and send it in the response body. This can be done in Postman as following : {{$body 'id' }}, but I don't…
1
vote
0 answers

Deploy mock-server instance for only staging/development environments

I need to implement a mock server whose instance needs to be deployed on non-production environments. I am using docker image mockserver/mockserver To Clarify I'll explain the scenario here: Our app will be using a 3rd part API which is not…
Adnan Ali
  • 2,890
  • 5
  • 29
  • 50
1
vote
1 answer

How to handle multiple mock response templates while designing a simple Mobile mock API testing system

There's an app that's in iOS, Android and Windows and that has plenty of web services and each web service has different response templates based on the input. So basically we'd like to run different mock scenarios for testing in mobile app so we…
King
  • 3,457
  • 3
  • 12
  • 22
1
vote
1 answer

Beeceptor: How can I have a mock rule with path param

I am using beeceptor for mocking an API. I can access a hard-coded path, but when I try to add path params to the mock URL I get a response saying that nothing is configured for this path. I tried the following: a regexp as a path param:…
1
vote
1 answer

Creating a soap mock server in flask

I've been using zeep as a client in my application to request data from SOAP APIs and I now want to build a simple mock server that returns some XML data. I thought I wouldn't need to build a true soap server and rather I'd just respond to requests…
1
vote
0 answers

Running Mockserver with parallel tests without starting application context

Mockserver offer the following advice for running tests in parallel it is recommended to either use a unique instance of MockServer per test or to run tests in series and clear all expectations prior to each test. mockserver documentation on…
1
vote
0 answers

Is it possible to see the response of a API call from Mirage JS in browser without calling it from code?

Here is the server creation : import { createServer } from "miragejs" export default function () { createServer({ routes() { this.get("/api/reminders", () => ({ reminders: [ { id: 1, text: "Walk the dog" }, …
Sultan
  • 72
  • 8
1
vote
1 answer

Is it possible to call a test feature from a MockServer feature(matched) in KarateDSL?

I'm trying to do something that I don't know if it is even remotely possible or not. I've a Mock server, and I'd like that when it receives a given request, it "starts another test", calling a test feature. I tried some stuff, including the one…
user1680680
  • 213
  • 2
  • 9
1
vote
0 answers

Mock Open API endpoints that haven‘t been implemented yet?

Mocking endpoints an Open API Specification file defines isn't all that difficult. However I am trying to mock only the endpoints that don't have an implementation yet. For example I have an OAS file that defines an GET /dogs and an GET /cats…
Michael Jauk
  • 41
  • 1
  • 6
1
vote
1 answer

MockServer headers expectations are too strict

I am trying to unit test a class whose main function is to make a REST client call. To invoke the REST api I am making use of OkHttp3 library. var apiClient = new OkHttpClient().newBuilder().build(); var request = new Request.Builder() …
Julian
  • 3,678
  • 7
  • 40
  • 72
1
vote
0 answers

java.lang.ClassNotFoundException: org.mockserver.version.Version

I am trying to start mock server with mockserver-netty-5.13.2 from shell, java version: 11.0.9 Rough shell code like this: java -version echo "start shell before java -jar line" java -jar ./mockserver-netty-5.13.2.jar -serverPort 9090 -logLevel…
1 2
3
11 12