SlideShare a Scribd company logo
Manjyot Singh
Ruchika Rawat
API Testing Workshop
Introduction
[
{
"speaker": {
"id": "007",
"name": "Manjyot Singh",
"role": "QA"
}
},
{
"speaker": {
"id": "001",
"name": "Ruchika Rawat",
"role": "QA"
}
}
]
What is a web service – QA point of view?
A method of communication between two web applications
Let’s play a video...
Example
Classifications
REST Vs SOAP
???
SOAP
● Simple object access protocol.
● Used for exchange of information on distributed platform using XML.
● Works mainly with HTTP, HTTPS.
● HTTP makes SOAP go around firewalls.
● Slower when using large XML messages.
???
REST
● Representational State Transfer.
● REST architectural style, data and functionality are considered
resources and are accessed using Uniform Resource Identifiers
(URIs).
● Resources are manipulated using a fixed set of four create, read,
update, delete operations: PUT, GET, POST, and DELETE.
● Formats - XML, plain text, PDF and JSON.
REST - Example
ResponseRequest
http://localhost:9000/users/1
Let’s talk about...
Why REST-assured ?
● Java Domain Specific Language (DSL) for testing web services
● Built on top of HTTPBuilder
● Supports response parsing
● Supports in-built assertions
● Supports BDD syntax
Setup (Requirement)
● Install JDK
● IDE (Eclipse/Intellij)
● Build Tool (gradle) *optional
● Rest-assured jars
● Hamcrest-matchers jars
● Junit jars
Understanding a Request
Simple GET Request
given().
contentType(“application/json”).
when().
get("/users").
then().
assertThat().
statusCode(HttpStatus.SC_OK);
GET Request
given().
contentType(“application/json”).
when().
get("/users/1").
then().
assertThat().
body("userId", equalTo(1)).
body("userName", equalTo("Robert")).
body("employer", equalTo("facebook")).
body("location.state", equalTo("California")).
body("location.city", equalTo("San Jose"));
POST Request
given().
contentType("application/json").
body("[{"userName":"Jayant2","employer":"Google","location":{"
state":"California","city":"Mountain View"}}]").
when().
post("/users").
then().
assertThat().
body("userName", hasItems("Jayant2"));
PUT Request
int userId = 1;
given().
contentType("application/json").
when().
body("{"userName":"Taylor"}").
put("/users/" + userId).
then().
statusCode(HttpStatus.SC_OK).
body("userName", equalTo("Taylor"));
DELETE Request
int userId = 9;
given().
when().
delete("/users/" + userId).
then().
statusCode(HttpStatus.SC_OK);
Response parsing
Response response =
given().
contentType(ContentType.JSON).
when().
get("/users/5").
then().
extract().response();
String userName = response.path("userName");
String userCity = response.path("location.city");
Assert.assertTrue(userName.equals("Steve"));
Assert.assertTrue(userCity.equals("San Francisco"));
Json parsing
String jsonResponse =
get("/users/5").
asString();
JsonPath jsonPath = new JsonPath(json).setRoot("location");
String state = jsonPath.getString("state");
String city = jsonPath.getString("city");
Assert.assertTrue(state.equals("California"));
Assert.assertTrue(city.equals("San Francisco"));
Authentication
String sessionToken =
given().
body("{"userName" : "ruchikar","password" : "P@ssW0rd"}").
when().
with().
header("Content-Type", "application/json").
header("X-Forwarded-Proto", "https").
post("/sessionTokens").
then().
statusCode(200).
contentType(ContentType.JSON).
extract().
response().path("response.sessionToken");
given().
when().
with().
header("X-Forwarded-Proto", "https").
header("Content-Type", "application/json").
header("X-Auth", sessionToken).
get(“/users”).
then().
statusCode(HttpStatus.SC_OK).
contentType(ContentType.JSON);
contd...
Other available tools/api
References
Rest-Assured: https://github.com/jayway/rest-assured
Github : https://github.com/jayway/rest-assured/wiki/Usage
Workshop Test framework: https://github.com/ruchikar/RestAssuredTest
Workshop WebService: https://github.com/syedatifakhtar/VodQABomb
Questions

More Related Content

PPTX
Time to REST: testing web services
PPTX
SOAP vs REST
PPT
Soap vs. rest - which is right web service protocol for your need?
PPTX
Web services soap and rest by mandakini for TechGig
PPTX
PPTX
Soap and restful webservice
PPTX
Web Services Testing
PPT
Soap Vs Rest
Time to REST: testing web services
SOAP vs REST
Soap vs. rest - which is right web service protocol for your need?
Web services soap and rest by mandakini for TechGig
Soap and restful webservice
Web Services Testing
Soap Vs Rest

What's hot (20)

PDF
SOAP vs REST
PPTX
Web services - A Practical Approach
PDF
RESTful Web Services with Spring MVC
PPTX
Designing REST services with Spring MVC
PPTX
REST and ASP.NET Web API (Milan)
PPTX
An Overview of Web Services: SOAP and REST
PDF
SOAP-based Web Services
PPTX
REST API Design
PDF
Restful web services by Sreeni Inturi
PPT
Soap and Rest
PPTX
RESTful Architecture
PPTX
Restful webservices
PPTX
PPTX
Overview of Rest Service and ASP.NET WEB API
PDF
Web Services
PDF
PPTX
Restful webservice
PPTX
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
PPT
RESTful services
PPTX
REST & RESTful Web Service
SOAP vs REST
Web services - A Practical Approach
RESTful Web Services with Spring MVC
Designing REST services with Spring MVC
REST and ASP.NET Web API (Milan)
An Overview of Web Services: SOAP and REST
SOAP-based Web Services
REST API Design
Restful web services by Sreeni Inturi
Soap and Rest
RESTful Architecture
Restful webservices
Overview of Rest Service and ASP.NET WEB API
Web Services
Restful webservice
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
RESTful services
REST & RESTful Web Service
Ad

Viewers also liked (16)

PPTX
Autoscalable open API testing
PPTX
Coherent REST API design
PDF
Heleen Kuipers - presentatie reinventing organisations
ODP
Creating a Java EE 7 Websocket Chat Application
PPTX
Testing RESTful web services with REST Assured
PPTX
Rest assured
PDF
Continuous Delivery Testing @HiQ
PDF
Auto-scaled Concourse CI on AWS w/o BOSH
ODP
Testing RESTful Webservices using the REST-assured framework
PDF
2015-StarWest presentation on REST-assured
PPTX
TestNG Framework
PPT
PDF
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
PPTX
Api testing
PDF
How to Automate API Testing
PDF
Key Factors To Ensure Test Automation Framework Success
Autoscalable open API testing
Coherent REST API design
Heleen Kuipers - presentatie reinventing organisations
Creating a Java EE 7 Websocket Chat Application
Testing RESTful web services with REST Assured
Rest assured
Continuous Delivery Testing @HiQ
Auto-scaled Concourse CI on AWS w/o BOSH
Testing RESTful Webservices using the REST-assured framework
2015-StarWest presentation on REST-assured
TestNG Framework
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Api testing
How to Automate API Testing
Key Factors To Ensure Test Automation Framework Success
Ad

Similar to Web service testing_final.pptx (20)

PDF
Webservices Testing PPT.pdf
PDF
Web Services Testing
PPTX
Increase automation to rest
PPTX
SOA Testing
PPTX
Api Testing
PPTX
Api Testing
PDF
API Testing Interview Preparation and Methods
PPTX
Rest assured
PPTX
Increase automation to rest
PDF
Increase automation to rest
PPSX
API Test Automation
PPTX
Apitesting.pptx
PDF
TEST PPTBCHDBHBHBHVBHJEFVHJVBFHVBFHVBHFVBFHVHFVBFHVBHFVBFHVBFHVBFVBFVBHVBVBFHVB
PPTX
Web API testing : A quick glance
PPTX
Soap UI and postman
PPTX
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
PPTX
Test Design and Automation for REST API
PPTX
API Testing Using REST Assured with TestNG
PPTX
Understanding_REST......................_APIs.pptx
PPTX
Автоматизация тестирования API для начинающих
Webservices Testing PPT.pdf
Web Services Testing
Increase automation to rest
SOA Testing
Api Testing
Api Testing
API Testing Interview Preparation and Methods
Rest assured
Increase automation to rest
Increase automation to rest
API Test Automation
Apitesting.pptx
TEST PPTBCHDBHBHBHVBHJEFVHJVBFHVBFHVBHFVBFHVHFVBFHVBHFVBFHVBFHVBFVBFVBHVBVBFHVB
Web API testing : A quick glance
Soap UI and postman
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
Test Design and Automation for REST API
API Testing Using REST Assured with TestNG
Understanding_REST......................_APIs.pptx
Автоматизация тестирования API для начинающих

More from vodqancr (8)

PPTX
Security testing zap it
PPT
Nakal
PDF
Laws of test automation framework
PPTX
Tests supporting multiple mobile platforms
PDF
Big data testing (1)
PDF
Espresso testing
PPT
Introduction to Gauge
PPTX
Unbox yourself Into Testing
Security testing zap it
Nakal
Laws of test automation framework
Tests supporting multiple mobile platforms
Big data testing (1)
Espresso testing
Introduction to Gauge
Unbox yourself Into Testing

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Review of recent advances in non-invasive hemoglobin estimation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
“AI and Expert System Decision Support & Business Intelligence Systems”
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
Network Security Unit 5.pdf for BCA BBA.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Monthly Chronicles - July 2025
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication

Web service testing_final.pptx