Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How do I allow jmeter to generate 2 seperate decimal values and use it in 2 parameters in http requests?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
390 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can generate a random float value using either any of JSR223 Test Elements and Groovy language or __groovy() function, the relevant code would be something like:

org.apache.commons.lang3.RandomUtils.nextFloat(0.0f, 100f)

in case of _groovy() function you need to escape the comma like:

${__groovy(org.apache.commons.lang3.RandomUtils.nextFloat(0.0f, 100f),)}

it will return a random float number in range from 0 to 100 (adjust as needed)

Demo:

JMeter Groovy Sum Random Floats

More information: Mathematical Functions and Converting Data Types in Groovy


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...