Suppose, I have given 50 numbers of users which are going to use the application during the Gatling tool Testing. That means 50 users load on the website. I want these 50 users to keep hitting the website for an hour continuously. Means, if one user performs 4 tasks (Add, update, delete, search ) then it should not stop after the completion of task but should keep doing the same task for an hour or two hours. Is there any parameter where we can set the duration so that the workload keeps hitting the website for such a long duration? Also all these users hit website simultaneously at the same time? I have checked docs but didn’t get the parameter where we can set the duration.
Hello,
Have you checked the documentation on loops?
Also regarding the duration of the test, this is set in the injection profile:
Best,
Pete
Hi Pete,
I go through the document and for my requirement during
will be fitted perfectly. That will give the duration of seconds the loop will iterate for that particular duration. Is my understanding correct? If yes, then I need to use during
in each scenario? I have sent the java file via email and in that I need to replace ‘pause’ with ‘during’ to cater my requirement, Is my understanding correct?
Yes, that’s correct.
Hi Pete, I have sent you the modified java file via email. When I replaced pause with during, I got error while executing gatling.bat. Below is the error:
Type the number corresponding to your choice and press enter
[0]
[1] Run the Simulation locally
[2] Package and upload the Simulation to Gatling Enterprise Cloud, and run it there
[3] Package the Simulation for Gatling Enterprise
[4] Show help and exit
1
18:53:24.310 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:113:1: illegal start of expression
18:53:24.315 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:194:1: ‘;’ expected
18:53:24.316 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:195:1: illegal start of expression
18:53:24.317 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:195:1: invalid method declaration; return type required
18:53:24.317 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:195:1: illegal start of type
18:53:24.319 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:206:1: illegal start of type
18:53:24.321 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:206:1: invalid method declaration; return type required
18:53:24.321 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:206:1: illegal start of type
18:53:24.322 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:217:1: illegal start of type
18:53:24.323 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:217:1: invalid method declaration; return type required
18:53:24.325 [ERROR] i.g.c.ZincCompiler$ - C:/D_Drive/gatling/source/user-files/simulations/apexdel/BasicSimulationApexDelete.java:217:1: illegal start of type
Apologies, I misunderstood your previous point. Your duration only needs to be in the injection block, not replacing the pauses.
EG:
setUp(
scn.injectOpen(constantUsersPerSec(10).during(300))
).protocols(httpProtocol);
Hi @sachinpadha,
If I understand, you have 4 steps (Add, update, delete, search).
What each user should (ie, a scenario) is to perform such task in a loop during an amount of time.
ScenarioBuilder scn = scenario("My scenario")
.exec(userInit)
.during(Duration.ofHours(1)).on(
exec(add, update, delete, search)
);
{
setUp(scn.injectOpen(atOnceUsers(50))).protocols(httpProtocol);
}
Does that help?
Cheers!
In the attached java file the below code is throwing an error:
//setUp(scn.injectOpen(atOnceUsers(1))).protocols(httpProtocol);
setUp(scn.injectOpen(atOnceUsers(10))).protocols(httpProtocol);
21:29:46.729 [ERROR] i.g.c.ZincCompiler$ - Compilation crashed
sbt.internal.inc.CompileFailed: null
at sbt.internal.inc.javac.AnalyzingJavaCompiler.$anonfun$compile$12(AnalyzingJavaCompiler.scala:179)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at sbt.internal.inc.javac.AnalyzingJavaCompiler.timed(AnalyzingJavaCompiler.scala:262)
at sbt.internal.inc.javac.AnalyzingJavaCompiler.compile(AnalyzingJavaCompiler.scala:161)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compileJava$2(MixedAnalyzingCompiler.scala:103)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compileJava$2$adapted(MixedAnalyzingCompiler.scala:91)
at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compileJava$1(MixedAnalyzingCompiler.scala:91)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
at sbt.internal.inc.MixedAnalyzingCompiler.compileJava(MixedAnalyzingCompiler.scala:61)
at sbt.internal.inc.MixedAnalyzingCompiler.compileJava0$1(MixedAnalyzingCompiler.scala:198)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:179)
at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:177)