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

Tuesday, 15 March 2022

Top 80 API Testing Interview Questions for QA and SDET ? API Interview Questions 2022

 


Check below link for question and answers with code:

Top API Interview Question 1-10


 

71. Explain some API defects that you have found in your recent project?

Ans: 
-- Incorrect status code for the negative scenario.
-- Authorization error with valid users.
-- Incorrect error messages for the negative scenario.
-- API HappyPath isn't working in Gamma environments.
-- Missing exception handling
-- Performance issue 

72. How do we identify JSON Array and JSON Object ?

Ans:

JSONObject:

  • Contains named values (key->value pairs)
    • like {id : 1}
  • Order of elements is not important
    • a JSONObject of {id: 1, name: 'test'} is equal to {name: 'test', id: 1}.

JSONArray:

  • Contains only series values
    • like [1, 'value']
  • Order of values is important
    • array of [1,'value'] is not the same as ['value',1]
      JSON Object --> { "":""}
      
      JSON Array --> [ , , , ]

73. What verifications needs to be done during API testing?

Ans:

  1. All kind of scenarios with request Parameters- Mandatory and optional.
  2. Request URL and protcols
  3. Request formats validation- json,xml,plain text etc
  4. Request headers- Authentication and if there is some parameters passed in headers.
  5. Response format and validation
  6. Response error codes- 2x for valid, 4x for unauthorized access, 5x server errors etc.
  7. Query and Path parameter validations.

74. How to check API responses in mobile (Android/IOS) browser?

Ans: Using Fiddler or Charles Proxy. A proxy server is an intermediary for requests which travel from client to server and vice-versa.
A proxy can exist on the same machine as the client or server, it can also exist on a separate machine. This is the case for the setup we are going to use in the current context where we will have a client (mobile phone with an application we want to debug), a proxy server (our PC ) and a Server (which communicates with the client).



75. Explain the Authorization in API?

Ans:  Click Here For All API Auth

76. How to do Load Testing with Postman?

Ans: 
Step 1- Click on the arrow along with your collection in the collection listing

Step 2- Then click on the Run button to launch Collection runner

Collection runner is the part which is used for Load testing


Step 3- Collection runner has a lot of important parts to consider for load testing like Iterations, Delay as shown in below screenshot.



77. What is the difference between 401 and 403?

Ans:  Click Here For Differences between 401 & 403

78. How to validate schema in Rest Assured?

Ans:
 
From version 2.1.0 REST Assured has support for Json Schema validation.
 It can be validated using below command:

get("/users")
.then().assertThat()
.body(matchesJsonSchemaInClasspath("users-schema.json"));

matchesJsonSchemaInClasspath is statically imported from io.restassured.module.jsv.JsonSchemaValidator

79. How to automate POST/PUT/PATCH using Rest Assured?

Ans:  Click Here For Automation Code

80. How to fetch all cookies in rest Assured?

Ans:

// Get all cookies as simple name-value pairs
Map<String, String> allCookies = response.getCookies();
// Get a single cookie value:
String cookieValue = response.getCookie("cookieName");
REVISION:

36. How to Create Fake-API which can be used for Testing in Postman or Rest Assured? Very Useful for real-time practice

 Ans: Steps with Screenshot to Create API from Scratch - Click Here

37. What are REstful Webservices?

Ans:Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web. 

So webservice which implements REST architectural style is called as Restful Webservices. For more info refer: https://docs.oracle.com/javaee/6/tutorial/doc/gijqy.html

38. What are the types of Status codes?

1xx informational response – the request was received, continuing process
2xx successful – the request was successfully received, understood, and accepted
3xx redirection – further action needs to be taken in order to complete the request
4xx client error – the request contains bad syntax or cannot be fulfilled
5xx server error – the server failed to fulfil an apparently valid request

3. What are the status codes you have come across in your API testing project?

Ans: Click Here For Status Codes

*******************************************************************
For any doubts or career guidance, arrange a 1:1 call with me 


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

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

Monday, 7 March 2022

How to setup Email Notification from Jenkins using Gmail account?




To perform email notification, we need to do a pre - setup gmail account and Jenkins.

Let's go through the pre-setup:

==> Pre Setup on Gmail

1. Turning on 'less secure apps' settings as mailbox user

  1. Go to your (Google Account).
  2. On the left navigation panel, click Security.
  3. On the bottom of the page, in the Less secure app access panel, click Turn on access.
    If you don't see this setting, your administrator might have turned off less secure app account access (check the instruction above).
  4. Click the Save button.

2. Turn Off two step verification 

How to schedule Job in Jenkins using CRON?

==> Pre-Setup on Jenkins


  • Now go to Manage Jenkins-> Configure System
  • Scroll down to the email notification section. If you are using Gmail, then type smtp.gmail.com for the SMTP server. 
  • Click on Advanced and select Use SMTP authentication. 
  • Enter your Gmail username and password. 
  • Select the Use SSL option and enter the port number as 465
  • Click on Apply and then Save.

After the pre-setup we need to go to the Jenkins job so that we can integrate the email notification:

Go to Job(Jenkins automation execution Job)

==> Configure

==> Post Build Actions 

==> Select “Editable Email Notification” from the dropdown 

==> Advanced Settings

==> Triggers

==> Add Trigger Always

==> Select “Recipient” for “Send To” option

==> Click on Advance 

==> Enter the recipient email id and change the subject as per your automation suite.


How to send Email Notification from Jenkins using Groovy Script?



Suggested Post:

ALL ABOUT AUTOMATION FRAMEWORK DESIGN

Java Interview question Set-1:

SET-01 1-10

Java Interview question Set-2:

SET-02 10-20

Java Interview question Set-3:

SET-03 21-30

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

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

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...