2017-07-27 39 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)