3
我嘗試使用各種「休息」和「atOnceUsers」進行注射。 我沒有找到一個很好的文檔解決方案。Gatling的可變rampUp
我的方法是用本地計數器創建一個名爲「getNextNumber()」的函數,以增加「atOnceUsers」的數量,但函數在開始時只調用一次。
任何想法?
我的代碼:
class TestCombinationGetFiles extends Simulation {
var counter: Int =1
def getNextNumber():Int = {
counter+= 1
return counter
}
val Get20Files = scenario("get20Files")
.feed(UuidFeeder.feeder)
.exec(WebAuth.AuthenticateUser)
.pause(30)
.exec(WebCloudContent.GoToTestFolder20)
val Get10Files = scenario("get10Files").feed(UuidFeeder.feeder)
.exec(WebAuth.AuthenticateUser)
.pause(15)
.exec(WebCloudContent.GoToTestFolder10)
val loadFolder20TestRamp =
scenario("loadFolder20TestRamp").exec(WebAuthSwisscom.AuthenticateUser,
WebCloudContentSwisscom.GoToTestFolder20)
setUp(Get20Files.inject(
splitUsers(36) into(
atOnceUsers(getNextNumber()))
separatedBy(30 seconds))
/* messy Code with correct functionality
atOnceUsers(1),
nothingFor(30 seconds),
atOnceUsers(2),
nothingFor(30 seconds),
atOnceUsers(3),
nothingFor(30 seconds),
atOnceUsers(4),
nothingFor(30 seconds),
atOnceUsers(5),
nothingFor(30 seconds),
atOnceUsers(6),
nothingFor(30 seconds),
atOnceUsers(7),
nothingFor(30 seconds),
atOnceUsers(8),
nothingFor(30 seconds))
*/
,
Get10Files.inject(
splitUsers(16) into(
atOnceUsers(1))
separatedBy(15 seconds))
).protocols(WebSetUp.httpProtocol)
}
拉動請求歡迎;-) –