cancel
Showing results for 
Search instead for 
Did you mean: 

how to count the number of rows fetched in data source

SOLVED
MKV
Contributor

how to count the number of rows fetched in data source

Hi,

 

Is it possible to count the number of datas fetched in a data source in readyapi? Can it be stored in a variable to use in the next steps.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Leader

Re: how to count the number of rows fetched in data source

Hi @MKV

 

Try below code:

DSrowCount = testRunner.testCase.testSteps["DataSource"].rowCount
log.info DSrowCount

 

Do Like/Accept it as Solution if it solves your query.

 

Thanks,

Himanshu Tayal


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
4 REPLIES 4
Community Leader

Re: how to count the number of rows fetched in data source

Hi @MKV

 

Try below code:

DSrowCount = testRunner.testCase.testSteps["DataSource"].rowCount
log.info DSrowCount

 

Do Like/Accept it as Solution if it solves your query.

 

Thanks,

Himanshu Tayal


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
MKV
Contributor

Re: how to count the number of rows fetched in data source

Thanks..It worked !!

Highlighted
Contributor

Re: how to count the number of rows fetched in data source

The problem is that the rowCount does not return the actual row count, in my case 200. I have to run my data source step manually first to create the rows and then rowCount will return the actual row count. When I try to automate this and I try to use: 

def tst = testRunner.runTestStepByName("myDataSource")

DSrowCount = testRunner.testCase.testSteps["myDataSource"].rowCount
log.info DSrowCount

it does not work. There are 200 rows in the datasource but the rowCount returns 1. Is there any way to make the rowCount return 200 instead of 1?

Thanks 

Community Hero

Re: how to count the number of rows fetched in data source

@tech321,

Would you mind opening a fresh thread (the previous one was already closed ) with more details of the issue such as what steps does the test case has? Where do you need that row count? What type of data source are you using?


Regards,
Rao.
New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors