gatling report statistics is also including time taken before actual tests are run plz help

Hi, I have some tests e.g.

scn_for_search_example_item.inject(rampUsers(30) over (30 seconds)),

but there are scripts running to fetch data before running test however time taken by data scripts is also added to report and result in false response time. Sorry I am bit new to Gatling, can you please advise how can i control it only start calculating after starting tests.

Your help will be much appreciated.

You may want to add your fetch data code in a before hook.

http://gatling.io/docs/2.1.5/general/simulation_structure.html#hooks

Thanks a lot mate. Will try it soon

Can you please help with where to use hook. Shall I use it in scenario

For example, in below scenario i am feeding sample from feedr class which i want to exclude from simulation.

val scn_example = scenario(Page + _PROGRAMME)
.feed(sample)
.during(duration) {
exec(http(yo_yo)
.get(BASE_URL)
.check(jsonPath(item).exists)
)

Yogesh Arora wrote:

Can you please help with where to use hook. Shall I use it in scenario

You can put the before hook as the first block in your class, but you will have to use straight Scala code and not the Gatling HTTP DSL.