'How to feed random numbers for the same variable names in Gatling
If you have a JSON, where it has an array of customers where each customer has to have a unique customer number, how can I feed this with random numbers:
{
"customers": [
{
"customerNo": "123",
"Name": "Joe"
},
{
"customerNo": "456"
"Name": "Jane"
},
]
}
I thought this might work:
{
"customers": [
{
"customerNo": "${customerNo}",
"Name": "Joe"
},
{
"customerNo": "${customerNo}"
"Name": "Jane"
},
]
}
val customerNumber = Iterator.continually(
Map("customerNumber" -> Random.nextInt(Integer.MAX_VALUE))
)
Then by adding:
feed(customerNumber)
But this uses the same generated number in both cases.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
