Anyone,
What is the current way to introduce pause before & after a request.
Below is how I have written the code but I am sure it doesn’t work as expected. I am expecting the requests to be 4s apart. See the diagram at bottom:
If I place pause inside exec code block, I get errors:
Desktop/gatling-charts-highcharts-bundle-2.2.3/user-files/simulations/computerdatabase/simulation.scala:47: value http is not a member of io.gatling.core.structure.ChainBuilder possible cause: maybe a semicolon is missing before `value http’? 16:35:23.284 [ERROR] i.g.c.ZincCompiler$ - http(requestName) 16:35:23.285 [ERROR] i.g.c.ZincCompiler$ - ^ 16:35:23.285 [ERROR] i.g.c.ZincCompiler$ - /Users/z0019cb/Desktop/gatling-charts-highcharts-bundle-2.2.3/user-files/simulations/computerdatabase/simulation.scala:48: type mismatch; found : String("${url}") required: Int
Hi, I need one more clarification, I have used convert function to change the type of parameter “reltime” from string to int. This value I am trying to pass to pause function & it works. But I want to do mathematical operation on this “reltime”; something like below
val pauseduration = “${reltime}” - (System.currentTimeMillis / 1000 - teststarttime)
here teststarttime is constant.
Error = 12:50:45.219 [ERROR] i.g.c.ZincCompiler$ - /Users/******/Desktop/gatling-charts-highcharts-bundle-2.2.3/user-files/simulations/computerdatabase/sample_simulation.scala:43: value - is not a member of String
val csvFeeder = csv(“test.csv”)
.queue
.convert{case (“reltime”, string) => string.toInt}
Thanks Stephen,
but I am not sure I am doing the session thing right as I am getting not found: value session error while running.
Below is my full code:
val scn = scenario(scenarioName)
.feed(csvFeeder)
val reltime = session(“reltime”).as[Int]
val pauseduration = reltime - (System.currentTimeMillis / 1000 - teststarttime)
.pause(pauseduration)
.during(testTimeSecs) {
exec(
http(requestName)
.get("${url}")
.headers(http_headers)
)