Forum Discussion

rajs2020's avatar
rajs2020
Frequent Contributor
4 years ago
Solved

ReadyAPI - How to validate the results of a datasource?

When we use a data source (DB, API, file etc.) in a test, then it is best to check if we got the right data before running the test. In case of DB, the right data can be the right number of rows and/or rows meeting certain criteria.

 

If we start getting less number of rows due to any changes in the DB or such, then our test will get the wrong inputs. We could prevent these data quality issues by having assertions/checks to see that we get the right data. We could do this for at least critical tests. In ReadyAPI, I could not find any such assertions in the DataSource test step. If it does not have any assertions, then why not? Can Smart bear add them later?

  • Hi,

     

    Assertions tend to be used to ensure the response from some service is valid.  I'm not sure why you'd doubt the data source, and assertions in the data-source step are something I've never felt required.

     

    If you do doubt your source, or want to check the rows prior to running a test, then the only thing I'd suggest is adding a JDBC Test Step before the datasource step and apply the assertions there.  If the assertion fails, then don't run the test.

     

     

1 Reply

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    Hi,

     

    Assertions tend to be used to ensure the response from some service is valid.  I'm not sure why you'd doubt the data source, and assertions in the data-source step are something I've never felt required.

     

    If you do doubt your source, or want to check the rows prior to running a test, then the only thing I'd suggest is adding a JDBC Test Step before the datasource step and apply the assertions there.  If the assertion fails, then don't run the test.