Forum Discussion

LukaszK's avatar
LukaszK
New Contributor
3 months ago

Executing test case loop multiple times

Hi, I'm new for ReadyAPI and I need to solve a problem.

I have a loop for request with reading data from Excel file using Data Source and Data Source Loop steps. It looks like on the picture below:

 

What I need is to run the whole loop configurable number of times. 

For example in the Data Source Excel there are four rows with data that are put in the Request. So the Request will be sent four times, each time with different data. And I want to execute this loop (four requests inside) for example for 20 times.

  • Hi,

    A simple, but might not be the best, is an 'outer' data source loop.  

    Create a new Excel spreadsheet with a 'iteration' column with four rows. E.g. 1,2,3,4.  This is your "configurable number of times loop".

    Before your original Data Source step, create a new Data Source Step called something like 'Outer loop', that links to the new spreadsheet.

    Finally, create a new Data Source loop that links back to the new 'outer' data source.

4 Replies

  • richie's avatar
    richie
    Community Hero

    Hey ChrisAdams 

    I saw this post but couldn't think of a way to do with without groovy - you've taught me something new - nice one!

    Rich

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    Hi,

    A simple, but might not be the best, is an 'outer' data source loop.  

    Create a new Excel spreadsheet with a 'iteration' column with four rows. E.g. 1,2,3,4.  This is your "configurable number of times loop".

    Before your original Data Source step, create a new Data Source Step called something like 'Outer loop', that links to the new spreadsheet.

    Finally, create a new Data Source loop that links back to the new 'outer' data source.

  • nmrao's avatar
    nmrao
    Champion Level 3

    If I understand right, LukaszK is trying to do some load test or repeat the test n times? If so, Load Test is what your need in this case. No change is required  to the test case.

    Just add load test to your test case by right click menu and.  use simple strategy with single thread for N times. Then run the load test of your test case.

    Please see the documentation here

    https://support.smartbear.com/readyapi/docs/performance/intro/about.html

    NOTE: Assuming that the same data from your data source can be repeated N times and services do not throw any error.

  • LukaszK's avatar
    LukaszK
    New Contributor

    nmraoChrisAdams 
    Thanks for help. Both of these works ok, and I need to think now what will work better in terms of reports needed.