mercredi 24 juin 2015

Json Request Response Test Cases

I am writing unit test cases for a project that will take JSON as post body and respond using JSON post body.

There are multiple checks to be made like: 1. Are all mandatory fields specified? 2. How is the system behaving with null values or field absence? 3. How is the system behaving with null values in inner jsons? 4. Boundary cases for numeric attributes.

For my initial set of unit test cases, I wrote multiple json's manually, store them as flat files and ran test cases. This will not scale out well for so many micro services.

So I want to achieve most of it using code. So in my initial phase I want to generate all permutation of json object given a skeleton. Like remove fields, make fields null, etc.

I am using Java 1.8, Jackson faster xml, jersey to achieve this. I am stuck at multiple fronts here. 1. Since this is a very common use case, am I unaware any specific tool? 2. Will Jackson JsonNode equals() method identify inequality with field value null or field absence. 3. What could be the impact on inner json nodes?

Thanks in advance Sri Harsha

Aucun commentaire:

Enregistrer un commentaire