How to inject 10 users every 10 seconds until max users reached?

147 views
Skip to first unread message

Feng Yu

unread,
Jan 6, 2017, 9:58:46 AM1/6/17
to Gatling User Group
Here is what I set:
    setUp(
        scn.inject(
            splitUsers(MAX_USERS_COUNT) into(
                atOnceUsers(10)
            ) separatedBy(10 seconds)
        ).protocols(httpProtocol)
    )


I find that MAX_USERS_COUNT must be multiples of ten, e.g 20,30,...40. 21 will just active 20 users. And If MAX_USERS_COUNT <= 10, e.g 1, will raise an error:
Exception in thread "main" java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated
        at io.gatling.charts.report.ReportsGenerator.generateFor(ReportsGenerator.scala:48)
        at io.gatling.app.RunResultProcessor.generateReports(RunResultProcessor.scala:76)
        at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:55)
        at io.gatling.app.Gatling$.start(Gatling.scala:61)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:41)
        at io.gatling.app.Gatling$.main(Gatling.scala:33)
        at io.gatling.app.Gatling.main(Gatling.scala)


Any ideas?

Feng Yu

unread,
Jan 7, 2017, 1:37:59 AM1/7/17
to Gatling User Group
I find if-else could work:
    val injectStrategy = 
        if (USERS_COUNT > 10) {
            splitUsers(USERS_COUNT) into(rampUsers(10) over(5 seconds)) separatedBy(10 seconds) 
        } else {
            atOnceUsers(USERS_COUNT)
        }

    setUp(
        scn.inject(
            injectStrategy
        ).protocols(httpProtocol)
    )



在 2017年1月6日星期五 UTC+8下午10:58:46,Feng Yu写道:
Reply all
Reply to author
Forward
0 new messages