Forum Discussion

LennSar's avatar
LennSar
Contributor
2 years ago
Solved

Data Source with random amount of lines

Hi there, I'd like to generate some dummy data using the Data Source / Loops functionality. It is important though to randomize the amount of data generated. Is there a way to do that with the data ...
  • SarahS's avatar
    2 years ago

    You can create a property to generate a random number, then pass that property into the number of rows in your datasource test step.

    I included a screenshot below that does this in a completely codeless approach. Under TestCase1 under RestProject 30 I have three test steps. 
    DataGen generates a random value between 5 and 10.
    The GroovyScript prints out the value of the random number. 
    And finally the datasource returns a number of rows equal to the random number. 

    Here are the results in RAPI.

     



    Hope this helps.