简体   繁体   中英

Gatling 3.7 setup duration time for the whole test

could someone help me?? how can I convert the below scale code to the Gatling 3.7 java?

values: testConfig.vUsers == 5 testConfig.rampup == testConfig.vUsers * 4 seconds = 20 seconds

setUp(
        Demo_Scenario.inject(rampUsers(testConfig.vUsers) during (testConfig.rampup))
    ).throttle(
        reachRps(109).in(436 seconds),
        holdFor(64 minutes)
    ).protocols(httpProtocol)
        .assertions(
            forAll.responseTime.mean.lte(200),
            forAll.responseTime.percentile3.lte(200),
            forAll.successfulRequests.percent.gte(95)
        )
}

and this one:

setUp(
        Demo_scenario.inject(rampUsers(testConfig.vUsers) during (testConfig.rampup))
    ).protocols(httpProtocol)
        .assertions(
            forAll.responseTime.mean.lte(200),
            forAll.responseTime.percentile3.lte(200),
            forAll.successfulRequests.percent.gte(95)
        )
}

and finally, how can I set up the duration for the full test let's say I want the test still running for 1 h??

thanks

There's some misunderstanding on some Gatling concepts here:

  • you define the users arrival rate over time with an injection profile
  • the virtual users perform a scenario
  • throttle merely sets a limit on your rps, it doesn't make your test last longer
  • rampUsers(5) during (20) is going to start a total of 5 users over 20 seconds, meaning 1 every 4 seconds

This is all explained in the official documentation and the free online courses .

So your test duration depends on:

  • how long your injection profile lasts
  • how long your virtual users take to perform their scenario

If Demo_Scenario only lasts 5 second, your test is going to complete after 25 seconds. If you want your test to last 1 hour:

  • either inject users for a long period
  • or make your scenario last longer, eg with loops

The suited solution really depends on your use case: do you want fresh new users or reuse the same few ones.

Note: Gatling 3.7 is deprecated, current version is 3.8.3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM