2017-07-27 138 views
1

我想使用normalPausesWithPercentageDuration我應該在哪裏聲明它並在我的gatling腳本中使用它。任何示例如何使用它將會更有幫助?如何在gatling中使用暫停?

import scala.concurrent.duration._ 
import io.gatling.core.Predef._ 
import io.gatling.http.Predef._ 

class temp extends Simulation { 

    val httpProtocol = http 
     .baseURL(testServerUrl) 

    val scn = scenario("Test data") 
     .feed(csvFeeder) 
     .exec(http("My Request") 
      .get("""/api/xyz/${ID}""") 
      ) 

     .normalPausesWithPercentageDuration(2) // This is not working 

    setUp(scn.inject(constantUsersPerSec(userCount) during(duration minutes))).protocols(httpProtocol) 

} 

謝謝:-)

回答

0

這是如何暫停,一些其他有用的代碼以及

exec(http("Poll") 
     .get(Configuration.URL) 
     .queryParam("requestor", "TEST") 
     .check(status.is(200)) 
     .check(status.saveAs("statusCode")) 
     .check(xpath("//status").saveAs("responseStatus")) 
    ) 
    .pause(Configuration.THINK_TIME second)