确保使用供料器在加特林(Gatling)中记录CSV记录 [英] Ensure CSV records in Gatling using feeder
问题描述
我在加特林使用CSV创建了一个简单的供稿器.该脚本运行良好,没有出现任何错误.我知道在负载测试期间正在从CSV中获取值.但是,如何确保每个用户都能获得哪个价值.我必须确保第一个用户应使用UserName:user1和Password:password1登录.因为我对加特林(Gatling)非常陌生,所以找不到解决方案.因此,请帮助我获得解决方案,在此先感谢......
I have created a simple feeder in Gatling with CSV. The script is working well and not getting any errors. I know values are fetching from the CSV during the load test. But how can I ensure which value is getting for each user. I have to ensure that first user should login with UserName: user1 and Password: password1. As I am very very new to Gatling I could not find a solution for this. Hence please help me to get a solution , Thanks in advance......
我的CSV包含-
user1密码1
user2 password2
user2 password2
user3 password3
user3 password3
供稿器的加特林脚本是:
And my gatling script for the feeder is:
val userCredentails= csv("user_credentials.csv").random
val scn = scenario("RecordedSimulation")
.exec(http("request_0")
.get("/thulasi/myhome.php")
.headers(headers_0)
.resources(http("request_1")
.post(uri1 + "/scripts/index.php")
.headers(headers_1)
.formParam("Action", "Offline"),
http("request_2")
.get(uri1 + "/images/footer.jpg"),
.pause(75)
// Login
.feed(userCredentails)
.exec(http("request_3")
.post("/thulasi/index.php")
.headers(headers_0)
.formParam("cand_user_cd", "${Username}")
.formParam("passwd", "${Password}")
.resources(http("request_4")
.post(uri1 + "/scripts/index.php")
.headers(headers_1)
.formParam("Action", "Offline"))
)
setUp(scn.inject(atOnceUsers(3))).protocols(httpProtocol)
}
推荐答案
检查Feeder文档: http://gatling.io/docs/2.2.0/session/feeder.html?highlight=feeders
Check Feeder docs: http://gatling.io/docs/2.2.0/session/feeder.html?highlight=feeders
只是不要在供料器上随机使用:
just don't use random on feeder:
val userCredentails = csv("user_credentials.csv")
- 从第一条记录到最后一条记录,当CSV =没有更多记录时崩溃,因此必须确保测试不会再加载更多记录
或使用通函:
val userCredentails = csv("user_credentials.csv").circular
- 这将一次又一次地从第一条记录到最后一条记录.
这篇关于确保使用供料器在加特林(Gatling)中记录CSV记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!