Feeder execution time is included in the scenario duration

Hello,

we have implemented custom Feeder which loads the data from Solr dynamically using Solr’s REST API before the main test (which stresses another API under test ) is being run.

This is happening as part of the scenario, e.g. every time the test is run the test data is being loaded from Solr into memory first.

It is quite a lengthy process - it takes 6 min to load the data. Let’s say the duration is set to 1 min. Gatling reports on the duration of the entire 7 min test run and not just 1 min for which we are interested to see the stats.

Can this behaviour be changed so that the time it takes feeder to load the data is not included in the test run. The reporting metrics are inaccurate as a result.

Natalie

Hi,

Where do you run this code? In a before block?

In the scenario itself. I am not aware about before block

Here is an example:

val scenario1 = scenario(“my scenario”)
.feed(data_1)
.during(duration) {
exec(http(TRANSACTION_1)
.get(URL)
check(jsonPath(PROG).exists)
)
.pause(1)
.feed(data_1)
}

The Gatling hooks are not included in the response times.
http://gatling.io/docs/2.1.5/general/simulation_structure.html#hooks

Thanks, sounds like this is might be a solution however the documentation says you can only put scala code in this block, not Gatling DSL.

Can I separate Feeder block in there? Has anyone got any working example they can post here, would be much appreciated.

Nat

Indeed, you can only execute custom code in before and after hooks, not run Gatling DSL.
If you want to perform HTTP requests in there, you can use AsyncHttpClient (the HTTP client Gatling uses underneath) or even UrlConnection.