How can I define a variable as a random match?
item[]
0{}
1{
_id:item
}
2{}
3{}
I want to define a match not with item[1]._id
but with item[random]._id
.
Could you please help me with that?
How can I define a variable as a random match?
item[]
0{}
1{
_id:item
}
2{}
3{}
I want to define a match not with item[1]._id
but with item[random]._id
.
Could you please help me with that?
Just a warning that trying to add such dynamic behavior to your tests makes them less maintainable in the long term.
Here is an example that works:
* def size = response.items.length
* def index = Math.floor(Math.random() * size)
* def item = response.items[index]