mercredi 25 juillet 2018

Storing test data for API tests using POJOs

I have a quite big json file and I need to test the API using it with bunch of data. I implemented the serialized version of the request using builders approach with POJOs. Everything is ok, but I use strings in the setters method, so it is hard coded.

Lets say I have this example:

{
   "name" : "my_username",
   "first-name" : "My",
   "last-name" : "Username",
   "display-name" : "My Username",
   "email" : "user@example.test",
   "password" : {
      "value" : "my_password"
   },
   "active" : true
}

My question: What is the best practice to store test data for api tests?

Properties file? Csv/excel and parse it? still json and using object mapper to create the object?

We need to focus on the easy storage and modification for creating new test cases. My idea is to create a big objects, storing somewhere the test data and using getters, I can build any request/response objects easily and I can avoid any maintenance issues. Thanks!

Aucun commentaire:

Enregistrer un commentaire