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.

asked Feb 16, 2018 at 10:39

2 Answers 2

1

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

answered Feb 16, 2018 at 10:57
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.
answered Jul 17, 2018 at 5:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.