Sunday 27 March 2022

What is Json Schema and how to perform schema validation using Rest Assured?



Check below link for question and answers with code:

Top API Interview Question 1-10


 


Table Of Contents:

What is Schema?

Why JSON Schema Validation is required? 

How to automate schema validation with Rest Assured?

COMMON ERROR found in schema validations

How to perform manual schema validation


What is Schema?

 Schema is nothing but a JSON file. It will only have datatype information and the expected keys of the JSON. There won't be any values present in the schema. 


Schema is an important concept to learn. JSON Schema is a JSON media type for defining the structure of JSON data. JSON Schema provides a contract for what JSON data is required for a given application and how to interact with it. JSON Schema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data.

SDET Interview Question and Answers.  

Jenkins Interview Questions and Answers


Why JSON Schema Validation is required? 

JSON Schema Validation is required to monitor API responses and ensure that the format that we are getting is the same as the expected one.


****************
Appium Interview Questions and Answers

Selenium Interview Questions and answers


**************

                    How to automate schema validation

  • Step-1: Add below dependency:

 



  • Step-2: Load expected schema

Load the expected "schema.JSON" in a file object.
You can create a schema from json using below website:

https://www.liquid-technologies.com/online-json-to-schema-converter

  • Step:3. Validate using matchesJsonSchema

Validate the response body using the matchesJsonSchema method. 

GIT Interview Questions and Answers






COMMON ERROR found in schema validations are:


Error:(common errors in your current project)

object has missing required properties 

instance type (integer) does not match any allowed primitive type (allowed: ["string"])


                   How to perform manual schema validation

TO COMPARE SCHEMA MANUALLY use below website:

http://www.jsondiff.com/
In the above we can paste both the schemas and do a comparison


Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session

TRANING VIDEOS AVAILABLE with Live Doubt Session @4500/-(course-1 below,API TRaining Videos With ClassNotes and Coding Set) and 6500/- (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122


Entire course content can be found below:  COURSE CONTENT

SDET Interview Question and Answers

TestNG Interview questions and answers

Jenkins Interview Questions and Answers

Appium Interview Questions and Answers

Selenium Interview Questions and answers

Java Coding Interview Questions and Answers

GIT Interview Questions and Answers



Check below link for question and answers with code:

Top API Interview Question 1-10

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions

No comments:

Post a Comment

All Time Popular Posts

Most Featured Post

Introduction to Web Testing with Playwright

  Introduction to Web Testing with Playwright 📌  Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 📌  YouTube channel:  https://lnkd.in/gGUG...