????????? MySimulation.scala ???? import ????????漲?????????:
import scala.concurrent.duration._
import scala.util.Random
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import Feeders._
class MySimulation extends Simulation {
val brownse = feed(randomOffsetFeeder)
.exec(
home
)
}
?????????????
????<= 10: ??????
????> 10: ?10?????10?????
val injectStrategy =
if (USERS_COUNT > 10) {
splitUsers(USERS_COUNT) into(
rampUsers(10) over(5 seconds)
) separatedBy(10 seconds)
} else {
atOnceUsers(USERS_COUNT)
}
?????????????
????= 0: ?????????????????????????????????
????> 0: ???????????????в???????????????????
val scn = scenario("My test scenario")
.doIfOrElse(DURATION > 0) {
forever(
exec(steps)
)
} {
exec(steps)
}
val setup = setUp(
scn.inject(
injectStrategy
).protocols(httpProtocol)
)
if (DURATION > 0) {
setup.maxDuration(DURATION minutes)
}