![](/img/trans.png)
[英]How to access a Gatling scenario from a different simulation file in Java
[英]How to create a Random Scenario in Scala for a Gatling Simulation
我使用下面的腳本來測試我的服務器與各種客戶端。
package test
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class Lasttest_ThinClient extends Simulation {
val httpProtocol = http
.baseUrl("http://localhost:8080")
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
val scn = scenario("Lasttest: Thin Client (X Clients)")
.exec(
http("UC-0")
.get("/movingAverage/50/abbn")
)
.pause(1,3)
.exec(
http("UC-1")
.get("/getBestValue")
.queryParam("min", "2")
.queryParam("max", "250")
.queryParam("name", "abbn")
)
.pause(1,3)
.exec(
http("UC-2")
.get("/getBestValueOneYear")
.queryParam("min", "2")
.queryParam("max", "250")
.queryParam("name", "abbn")
)
.pause(1,3)
.exec(
http("UC-3")
.get("/bestSimpleAveragePortfolio")
)
.pause(1,3)
.exec(
http("UC-5")
.get("/buyHoldPortfolio")
)
.pause(1,3)
.exec(
http("UC-6")
.get("/getBestStrategy")
)
.pause(1,3)
.exec(
http("UC-7")
.get("/getBestStrategyOneYear")
)
setUp(
scn.inject(
atOnceUsers(3),
).protocols(httpProtocol)
)
}
是否有可能隨機化用例的運行方式。 以便每個客戶隨機選擇 7 個用例中的 3 個。 創建一個面向實踐的場景而不是簡單地按順序執行所有用例會很好。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.