cancel
Showing results for 
Search instead for 
Did you mean: 

How to check a count against a db?

strim355z
Occasional Contributor

How to check a count against a db?

I have a get that returns 8 records.  If I do a JSONPath assertion for count from the outline view, it automatically populates 8 for me but how can I check that the count returned is matching the db count?  Thank you.

2 REPLIES 2
gilugopi
Contributor

Re: How to check a count against a db?

There are many ways to do it. But the easiest I think is to just create a JDBC test step and put your SQL query to retrun count form DB ( something like 'select count(*) count from table  where ..... ' )

 

and then under your Json path assertion give Expected result as.

 

${#<jdbc_test_step_name#ResponseAsXml#//count}

 

Regards,

Gilu Gopi

 

 

strim355z
Occasional Contributor

Re: How to check a count against a db?

Thank you Gilu I have much to learn. I created my jdbc teststep and my query returned 8, my jpath assertion looks a little different but it seems to be working!

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors