0

I am automating testing web services in robot framework RIDE and I am getting the response I am expecting and saving the response to variables. So I would like advice on how to go about comparing the data I got from the response with the data that is in the database.

0

Do you have direct access to the DB, the DB is is not changing too often, and you know the mapping between the DB status and the response you got ? If so just query it directly

Other options might be

  • Adding a "secret" API that returns an exact copy of the relevant data in the database, this could be a webservice API or a backdoor like ssh-ing somewhere.

  • Follow you actions starting with a clean DB so you can calculate the state of the DB

0

Create a class for DB Connection. Assuming that you have the DB scripts to fetch data from DB which is some ResultSet(an Object) and you also have some your API response in form of some Object(mostly an HttpResponse object).

I believe comparing two Objects is not so difficult. You can think of

  • overriding the equals method in the language construct.
  • Serialize the response to a model and then query the model to fetch the required attribute and then compare.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.