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

Standalone wiremock server as spring boot application

I am trying to make a mock service as a spring boot application. Can I use standalone mock server inside a spring boot application? When I tried to run a mock server on any port inside the spring boot application it throws the "Address already bound…
Monish Das
  • 383
  • 2
  • 12
  • 28
1
vote
1 answer

wiremock to mock public backend response

I am testing on an app that is making calls to a public backend. I want to use wiremock to mock reponses from the public backends. I was looking at something like the app makes a request to api.example.com which is forced through the wiremock proxy…
1
vote
1 answer

address already in use in async client tests in python

I have a question about async client tests. Here is my code about my test class TestSocketClient: @classmethod def setup_class(cls): # enable parallel testing by adding the pytest worker id number to the default port …
zhen404
  • 111
  • 1
  • 7
1
vote
0 answers

Display an image returned by MockServer on a web page using React?

I am using Mock Server with OPEN API 3.0 to mock data & expectations. I need to fetch a dummy image using Mock Server as per the given sample on: https://www.mock-server.com/mock_server/getting_started.html#button_response_literal_binary_PNG_body I…
program_bumble_bee
  • 439
  • 2
  • 25
  • 57
1
vote
0 answers

Mockserver implementation fails with connection refused error

We have implemented a mock server for unit tests in golang. If we run the test cases which use mockserver. it is inconsistent. Sometimes it fails with this error dial tcp 127.0.0.1:46686: connect: connection refused For port , we have this code…
Prems
  • 101
  • 11
1
vote
0 answers

Persisting Journal Requests and stub request to keep instances in sync when wiremock scaled up

Was looking for any common library in WireMock that would help when the mock server is scaled up. Currently I have a single server running on Ec2 that goes down during a deployment. To have all my instances in sync with the stub mappings and journal…
1
vote
0 answers

Not possible to establish TLS with MockServer: curl: (60) Peer's Certificate issuer is not recognized

I am trying to set up a docker network consisting of two containers: MockServer running on 443 Client (fedora) issuing requests to MockServer I've installed The MockServer CA X.509 taken from…
Vasiliy Vlasov
  • 3,316
  • 3
  • 17
  • 20
1
vote
0 answers

MockServer with Quarkus: "Discovered multiple competing ParameterResolvers"

I'm trying to use MockServer to test an API Client with Quarkus. Here is my test code: //@QuarkusTest @ExtendWith(QuarkusTestExtension::class, MockServerExtension::class) class APIClientTest(private val mockServerClient: MockServerClient) { …
Adam Millerchip
  • 20,844
  • 5
  • 51
  • 74
1
vote
1 answer

Can I test HttpClient Request With MockRestServiceServer

In my application, I have external third party API requests. I want to test my application with mocking this API requests. My Service Class: String API_URL = "https://external.com/v1/%s"; private CloseableHttpClient httpClient; public Result…
Sha
  • 921
  • 17
  • 46
1
vote
1 answer

Karate framework - mock server define thread pool

I'm using karate framework for load testing and ruining mock server using following command with -T option to achive higher tps and it seems it is not effected and its always run 8 threads which is number of cores in the server. java -jar…
someone
  • 6,577
  • 7
  • 37
  • 60
1
vote
0 answers

MockServer as Socks proxy not working with curl

I started a MockServer using java -jar mockserver-netty-5.10.0-jar-with-dependencies.jar -serverPort 1080 Now if i do (no sock proxy) curl https://www.google.com it work html get printed But If i do (with socks proxy) curl --socks5-hostname…
Bhuvan
  • 4,028
  • 6
  • 42
  • 84
1
vote
2 answers

Mock-Server - Custom object as REST response

I'm using Mock-Server (mock-server.com) in version 5.10.0 for mocking a REST-API in a JUnit 5 test. I'm developing a spring-boot application with Java 8. My payload format is "protobuf" and so my REST interface is returning a…
1
vote
1 answer

How to mock a JPA repo in a Karate Mock Servlet Config?

I have a spring boot 2.2.4 project with a REST controller, a service and a JPA repository. I can use the karate mock servlet to define a mock for the controller and service, but I don't know what to do for the repository. The controller…
joe
  • 220
  • 2
  • 11
1
vote
0 answers

Which Mockserver to use when dealing with different webservices (Rest and SOAP)?

I do have a lot of experiences in automation testing and testing API and SOAP with SoapUi for example, but I never use a mock server. It's actually make a lot of sense to use it. For my purpose of testing I have the following requirements…
3logy
  • 2,634
  • 8
  • 46
  • 99
1
vote
1 answer

Mocking object as response with Java's MockServer

I'm working on my integration-tests and I want to mock API calls with Java's MockServer. MockServersClient have a method which mocks response but only by string as a parameter. Example: new MockServerClient("localhost", 1080) .when( …
amerr-k
  • 39
  • 7