Can JMeter call an HTTP request

I want to mock HTTP requests, which means sending a real request to a real server , but ignore (don't wait) and override the response with a dummy response,

JMeter has many tools that are close, but not enough,

The DummySampler plugin is close, but doesn’t actually send a request,

an old answer directly to the Mirror Server which seems inconsequential for specific API requests and responses.

JMeter does not model servers.

Having said that, JMeter 2.3 has a built-in mirror server - it accepts any HTTP request and responds with a page containing the Details request.

If server B does not care about what server C sends back, you can use this to “layout” server C.

My answer about ignoring the HTTP response by adding a Runtime controller with 1 second and updating the response data is a problematic workaround, but may work.

Is there a better option available in plugins or running another tool in parallel?

Is opening an extension for JMeter relevant, and if so, should it improve the HTTP request or is it a new sampler like a Mock HTTP Request? Can the Runtime controller only support sending and stop waiting for a response (for example, using 0 seconds)?

+4
source share
2 answers

- WireMock, .

JMeter, WireMock jar ( ) JMeter Classpath WireMockServer JSR223, Groovy .

Groovy, WireMock Java-, OS Process Sampler


import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.stubbing.StubMapping;

import static com.github.tomakehurst.wiremock.client.WireMock.*;

public class WireMockTest {

    public static void main(String[] args) {
        WireMockServer wireMockServer = new WireMockServer();
        configureFor("0.0.0.0", 8080);
        wireMockServer.start();
        StubMapping foo = stubFor(get(urlEqualTo("/wiretest"))
                .willReturn(aResponse()
                        .withStatus(200)
                        .withBody("Hello World")));
        wireMockServer.addStubMapping(foo);
    }
}
+6

(fooobar.com/questions/1694524/...), "bzm - Parallel Controller" WireMockServer:

-1

Source: https://habr.com/ru/post/1694524/


All Articles