Mock requests in transaction

Gatling version: 3.12.0 (must be up to date)
Gatling flavor: java kotlin scala javascript typescript
Gatling build tool: maven gradle sbt bundle npm

I read the guidelines and how to ask a question topics.
I provided a SSCCE (or at least, all information to help the community understand my topic)
I copied output I observe, and explain what I think should be.

Hello Gatling Community,

I’m facing an issue where I need to mock (not actually perform) a specific request within a transaction, while still including its time in the total transaction duration calculation.

A real-world example would be a third-party request that incurs a cost, but where I already know the range of its response times.

In JMeter, we have something like the Dummy Sampler, which allows for this kind of functionality.

Is there a simple way to achieve this in Gatling?

I created a workaround that works for me (see the example here),
but I don’t really want to reinvent the wheel if Gatling already has this feature.
So maybe I missed something?

From my perspective, it looks like all I need is statsEngine.logResponse().

Thanks!

A simple pause would do the work and its duration would be included in the group duration metric.

Is there a workaround available if I prefer to use CumulatedResponseTime instead of GroupDuration?
I apologize for not noticing this in the original topic.

I plan to use pauses between requests.

CumulatedResponseTime only accounts for real traffic time so no, it wouldn’t work.

This is the first time we ever have this feature request so we won’t work on this unless there’s enough demand.

I’m looking for workarounds. The only ones I can think of are:

  • pause + GroupDuration
  • deploy a mock app with controlled response time (there are plenty of these out there)
1 Like

Hi @i-nahornyi.
If you want save this mock transaction (it could be pause, random code block, etc) to report, try to use this plugin: GitHub - polarnik/gatling-asynclog-plugin: Flexible log writer for Gatling 3. Here examle of the simulation GitHub - polarnik/gatling-asynclog-plugin: Flexible log writer for Gatling 3.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.