SlideShare a Scribd company logo
Increase Automation to
REST
Understanding Web Services
and how to test them
Shiva and Fiona
Key
Take
Aways:
❏ What Web Services are and why we
use them
❏ How to test a Web Service in
multiple ways
❏ Increased familiarity with test
automation
Web Services
● Interface to provide access to
functionality
● Uses HTTP/HTTPS/SMTP for
communication
● Communicates using
JSON/XML/CSV/Plain Text etc.
When and Why
Same functionality multiple UIs:
● Customise cross platform
● Multiple apps
● Different vendors
Being able to implement one
service and use that functionality
across all these different displays
Let see an example!
...things get clearer when you can see them :)
An Example
Website serving request:
Weather Underground
Underlying HTTP request:
curl -X GET http://api.
wunderground.
com/api/e896598d74613088/conditi
ons/q/zmw:00000.1.43128.json
Another Example
Booking a ticket with Orange Bus via
different agencies
RedBus UI TravelYari UI Orange Bus UI
Book
a seat
Book
a seat
Get bus
details
Orange Bus Web Service
REpresentational State
Transfer (REST)
● Uses HTTP(S) for CRUD
operations
● Uniform Resource Identifiers
(URIs)
● New alternative to SOAP
Statelessness
Client
Load Balancer
Node 1 Node 2
What about APIs?
● Part of the web service which
receives requests/sends
responses
● Has one or more endpoints
● Documented contract
Requests and Responses
...lets see some examples...
Request
Request:
URI Method Headers DATA
Response
Response
HeadersResponse Code Data
Requests
Common request types:
● GET
● POST
● PUT
● DELETE
Response Codes
Outcome of a request:
● 1xx - Informational
● 2xx - Success
● 3xx - Redirection
● 4xx - Client Error
● 5xx - Server Error
Increase automation to rest
Increase automation to rest
Increase automation to rest
Increase automation to rest
Increase automation to rest
Increase automation to rest
QAs and Web Services
...based on our experiences testing web services out in the wild...
How testing helps
● Business issues first then the
presentation issues
● Early feedback
● Debug in different layers
● Save time retesting
● More confident app works
● Release more frequently
● Lots more….
The role of QAs
Demo - try it yourself!
Manual in browser test
https://petal-spirit.hyperdev.space/
Postman
Sample Postman Request:
curl
Sample Curl Request:
curl -X GET https://petal-spirit.hyperdev.space/dreams -H "Content-Type: application/json" -i
> curl _
Alternatives?
Cocoa Rest Client
IntelliJ REST
Plugin
Let’s automate it! - Java
Use Library: UniRest (Java)
Sample Test Scenario
public class TestDreams {
@Test
public void testGetDreams() throws UnirestException {
System.out.println("Testing Get Dreams.....");
String url = "https://petal-spirit.hyperdev.space/dreams";
HttpResponse<JsonNode> jsonResponse = Unirest.get(url)
.header("Content-Type", "application/json").asJson();
Assert.assertEquals(200, jsonResponse.getStatus());
Assert.assertNotNull(jsonResponse.getBody());
}
}
Let’s automate it! - Python
Use Package: Requests (Python)
Sample Test Scenario
import unittest
import requests
class TestDreams(unittest.TestCase):
def setUp(self):
self.url = 'http://petal-spirit.hyperdev.space/dreams'
def test_should_verify_get_dreams(self):
print("Verifying Get Dreams....")
headers = {"Content-Type": "application/json"}
res = requests.get(url=self.url, headers=headers, verify=False)
self.assertEqual(200, res.status_code, "Response code doesn't match")
self.assertTrue(res.json())
Closing notes
...time flies when you’re automating tests...
Suggestions
● Test as you go
● Cross role pairing
● Integrate with build pipeline
● If the service is broken no need
to test UI
● Spread the word! :)
Key
Take
Aways:
❏ What Web Services are and why we
use them
❏ How to test a Web Service in
multiple ways
❏ Increased familiarity with test
automation
Questions
?

More Related Content

PDF
Gatling Performance Workshop
PDF
Sharing the pain using Protractor
PDF
Cucumber ppt
PPTX
Lets cook cucumber !!
PPTX
Protractor for angularJS
PPTX
Increase automation to rest
PPTX
Selenium with protractor
PPTX
Cucumber presenation
Gatling Performance Workshop
Sharing the pain using Protractor
Cucumber ppt
Lets cook cucumber !!
Protractor for angularJS
Increase automation to rest
Selenium with protractor
Cucumber presenation

What's hot (20)

PPTX
Test Automation Framework with BDD and Cucumber
PPTX
Ui Testing with Ghost Inspector
PDF
The What, Why and How of (Web) Analytics Testing (Web, IoT, Big Data)
PPTX
Api testing libraries using java script an overview
PPTX
Migration from AngularJS to Angular
PPTX
Automated Testing with Cucumber, PhantomJS and Selenium
PPTX
Heuristics to scale your framework
PPTX
Better End-to-End Testing with Page Objects Model using Protractor
PDF
How to go about testing in React?
PPTX
Protractor survival guide
PPTX
Cypress first impressions
PPTX
Cucumber Tool
PPTX
Cucumber BDD
KEY
Jellyfish, JSCONF 2011
PDF
Getting Started With Cypress
PPTX
Introduction to Bdd and cucumber
PDF
The what, why and how of web analytics testing
PPTX
Bdd – with cucumber and gherkin
PPTX
Introduction to cypress in Angular (Chinese)
PPTX
Protractor training
Test Automation Framework with BDD and Cucumber
Ui Testing with Ghost Inspector
The What, Why and How of (Web) Analytics Testing (Web, IoT, Big Data)
Api testing libraries using java script an overview
Migration from AngularJS to Angular
Automated Testing with Cucumber, PhantomJS and Selenium
Heuristics to scale your framework
Better End-to-End Testing with Page Objects Model using Protractor
How to go about testing in React?
Protractor survival guide
Cypress first impressions
Cucumber Tool
Cucumber BDD
Jellyfish, JSCONF 2011
Getting Started With Cypress
Introduction to Bdd and cucumber
The what, why and how of web analytics testing
Bdd – with cucumber and gherkin
Introduction to cypress in Angular (Chinese)
Protractor training
Ad

Similar to Increase automation to rest (20)

PPTX
Increase automation to rest
PDF
Unify service and ui layer automation bdd way.pptx (1)
PPTX
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
PPTX
AngularJS with TypeScript and Windows Azure Mobile Services
PDF
cross-platform-assets-based-front-end-architecture
PPTX
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
PPTX
Load Impact
PDF
Computer Science Research Poster Summer 15(1)
PDF
Selenium RC: Automated Testing of Modern Web Applications
KEY
Architecting single-page front-end apps
PDF
Web Service and Mobile Integrated Day I
PPTX
Whys and Hows of Automation
PPT
Ajax Testing Approach
PPT
Ajax Testing Approach
PPT
Webservices
KEY
Message in a Bottle
PDF
Google App Engine Overview - BarCamp Phnom Penh 2011
PPT
Less12 3 e_loadmodule_2
PPTX
Do not automate GUI testing
PPTX
Microservices with .Net - NDC Sydney, 2016
Increase automation to rest
Unify service and ui layer automation bdd way.pptx (1)
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
AngularJS with TypeScript and Windows Azure Mobile Services
cross-platform-assets-based-front-end-architecture
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
Load Impact
Computer Science Research Poster Summer 15(1)
Selenium RC: Automated Testing of Modern Web Applications
Architecting single-page front-end apps
Web Service and Mobile Integrated Day I
Whys and Hows of Automation
Ajax Testing Approach
Ajax Testing Approach
Webservices
Message in a Bottle
Google App Engine Overview - BarCamp Phnom Penh 2011
Less12 3 e_loadmodule_2
Do not automate GUI testing
Microservices with .Net - NDC Sydney, 2016
Ad

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
history of c programming in notes for students .pptx
PPTX
L1 - Introduction to python Backend.pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
AI in Product Development-omnex systems
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
ai tools demonstartion for schools and inter college
PDF
medical staffing services at VALiNTRY
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Transform Your Business with a Software ERP System
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
ManageIQ - Sprint 268 Review - Slide Deck
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How to Migrate SBCGlobal Email to Yahoo Easily
history of c programming in notes for students .pptx
L1 - Introduction to python Backend.pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
AI in Product Development-omnex systems
Design an Analysis of Algorithms I-SECS-1021-03
ai tools demonstartion for schools and inter college
medical staffing services at VALiNTRY
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Softaken Excel to vCard Converter Software.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Transform Your Business with a Software ERP System
Wondershare Filmora 15 Crack With Activation Key [2025
How Creative Agencies Leverage Project Management Software.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx

Increase automation to rest

  • 1. Increase Automation to REST Understanding Web Services and how to test them Shiva and Fiona
  • 2. Key Take Aways: ❏ What Web Services are and why we use them ❏ How to test a Web Service in multiple ways ❏ Increased familiarity with test automation
  • 3. Web Services ● Interface to provide access to functionality ● Uses HTTP/HTTPS/SMTP for communication ● Communicates using JSON/XML/CSV/Plain Text etc.
  • 4. When and Why Same functionality multiple UIs: ● Customise cross platform ● Multiple apps ● Different vendors Being able to implement one service and use that functionality across all these different displays
  • 5. Let see an example! ...things get clearer when you can see them :)
  • 6. An Example Website serving request: Weather Underground Underlying HTTP request: curl -X GET http://api. wunderground. com/api/e896598d74613088/conditi ons/q/zmw:00000.1.43128.json
  • 7. Another Example Booking a ticket with Orange Bus via different agencies RedBus UI TravelYari UI Orange Bus UI Book a seat Book a seat Get bus details Orange Bus Web Service
  • 8. REpresentational State Transfer (REST) ● Uses HTTP(S) for CRUD operations ● Uniform Resource Identifiers (URIs) ● New alternative to SOAP
  • 10. What about APIs? ● Part of the web service which receives requests/sends responses ● Has one or more endpoints ● Documented contract
  • 11. Requests and Responses ...lets see some examples...
  • 14. Requests Common request types: ● GET ● POST ● PUT ● DELETE
  • 15. Response Codes Outcome of a request: ● 1xx - Informational ● 2xx - Success ● 3xx - Redirection ● 4xx - Client Error ● 5xx - Server Error
  • 22. QAs and Web Services ...based on our experiences testing web services out in the wild...
  • 23. How testing helps ● Business issues first then the presentation issues ● Early feedback ● Debug in different layers ● Save time retesting ● More confident app works ● Release more frequently ● Lots more….
  • 24. The role of QAs
  • 25. Demo - try it yourself!
  • 26. Manual in browser test https://petal-spirit.hyperdev.space/
  • 28. curl Sample Curl Request: curl -X GET https://petal-spirit.hyperdev.space/dreams -H "Content-Type: application/json" -i > curl _
  • 30. Let’s automate it! - Java Use Library: UniRest (Java) Sample Test Scenario public class TestDreams { @Test public void testGetDreams() throws UnirestException { System.out.println("Testing Get Dreams....."); String url = "https://petal-spirit.hyperdev.space/dreams"; HttpResponse<JsonNode> jsonResponse = Unirest.get(url) .header("Content-Type", "application/json").asJson(); Assert.assertEquals(200, jsonResponse.getStatus()); Assert.assertNotNull(jsonResponse.getBody()); } }
  • 31. Let’s automate it! - Python Use Package: Requests (Python) Sample Test Scenario import unittest import requests class TestDreams(unittest.TestCase): def setUp(self): self.url = 'http://petal-spirit.hyperdev.space/dreams' def test_should_verify_get_dreams(self): print("Verifying Get Dreams....") headers = {"Content-Type": "application/json"} res = requests.get(url=self.url, headers=headers, verify=False) self.assertEqual(200, res.status_code, "Response code doesn't match") self.assertTrue(res.json())
  • 32. Closing notes ...time flies when you’re automating tests...
  • 33. Suggestions ● Test as you go ● Cross role pairing ● Integrate with build pipeline ● If the service is broken no need to test UI ● Spread the word! :)
  • 34. Key Take Aways: ❏ What Web Services are and why we use them ❏ How to test a Web Service in multiple ways ❏ Increased familiarity with test automation