Fix dynamic parameter

Wrong Gatling usage: randCustId() was only called once. One needs to pass a function.
This commit is contained in:
Stephane Landelle 2020-09-06 23:29:31 +02:00
parent 1927bb1b46
commit eed6c93543
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ class RewardsScenario extends Simulation {
.repeat(10){ .repeat(10){
exec(http("transactions_add") exec(http("transactions_add")
.post("/transactions/add/") .post("/transactions/add/")
.body(StringBody("""{ "customerRewardsId":null,"customerId":""""+ randCustId() + """","transactionDate":null }""")).asJson .body(StringBody(_ => s"""{ "customerRewardsId":null,"customerId":"${randCustId()}","transactionDate":null }""")).asJson
.check(jsonPath("$.id").saveAs("txnId")) .check(jsonPath("$.id").saveAs("txnId"))
.check(jsonPath("$.transactionDate").saveAs("txtDate")) .check(jsonPath("$.transactionDate").saveAs("txtDate"))
.check(jsonPath("$.customerId").saveAs("custId"))) .check(jsonPath("$.customerId").saveAs("custId")))