cancel
Showing results for 
Search instead for 
Did you mean: 

Compare multiple values from database against API response

SOLVED
Arunachalam_RM
Occasional Contributor

Compare multiple values from database against API response

Consider I am having one API which asks id as input.that id I can fetch from database and I can iterating the same request with multiple Id from database. It will produce response as per the id mentioned in request.now I am taking some other values from database (age,name) but these values not act as input parameter for API request.can I validate the name and age which is coming for each response with the database (it needs to match with age and name of the current Id input).

 

Can I use outline in response,to check for contains assertion ,how the actual value will get dynamically changed and compared against particular database row values?

 

Can I do this without groovy scripting? @tristaanogre  @AlexKaras

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Compare multiple values from database against API response

If I understand the use case correctly, the DB call could be set as a JDBC Datasource that would have properties (columns) for each value you want to use either in a request or as part of the validation. The Datasource would split each record into a new row, so the input value and expected values are aligned in the assertion or other test steps that follow. In your requests, the Get Data menu can build a reference to the input value, while Get Data can also be used in assertions (either added via the outline view, or for something like a 'contains' assertion)

 

This only really works when a single table/SQL returns all the values required - if it happens across multiple calls, the data would have to be organized as part of the test flow before being mapped to a datasource.

View solution in original post

1 REPLY 1

Re: Compare multiple values from database against API response

If I understand the use case correctly, the DB call could be set as a JDBC Datasource that would have properties (columns) for each value you want to use either in a request or as part of the validation. The Datasource would split each record into a new row, so the input value and expected values are aligned in the assertion or other test steps that follow. In your requests, the Get Data menu can build a reference to the input value, while Get Data can also be used in assertions (either added via the outline view, or for something like a 'contains' assertion)

 

This only really works when a single table/SQL returns all the values required - if it happens across multiple calls, the data would have to be organized as part of the test flow before being mapped to a datasource.

View solution in original post

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