Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Web services/API testing

401 views

Published on

Web services/API testing

Published in: Education
  • Be the first to comment

Web services/API testing

  1. 1. API/Web Services Testing
  2. 2. www.pavanonlinetrainings.com What is Client and Server? • What is a Client? • A client is a computer hardware device or software that accesses a service made available by a server. The server is often (but not always) located on a separate physical computer. • What is a Server? • A server is a physical computer dedicated to run services to serve the needs of other computers. Depending on the service that is running, it could be a file server, database server, home media server, print server, or web server.
  3. 3. www.pavanonlinetrainings.com Client/Server Architecture
  4. 4. www.pavanonlinetrainings.com Client/Server Architecture
  5. 5. www.pavanonlinetrainings.com What is an API? • API is means Application Programming Interface. • It enables communication and data exchange between two separate software systems. • A software system implementing an API contains functions/sub-routines which can be executed by another software system.
  6. 6. www.pavanonlinetrainings.com What is API testing? • API Testing is entirely different from GUI Testing and mainly concentrates on the business logic layer of the software architecture. This testing won't concentrate on the look and feel of an application. • Instead of using standard user inputs(keyboard) and outputs, in API Testing, you use software to send calls to the API, get output, and note down the system's response. • API Testing requires an application to interact with API. In order to test an API, you will need to  Use Testing Tool to drive the API  Write your own code to test the API
  7. 7. www.pavanonlinetrainings.com API Testing V/S Unit Testing Unit Testing API testing Developers perform it Testers perform it Separate functionality is tested End to end functionality is tested Developer can access the source code Testers cannot access the source code UI testing is also involved Only API functions are tested Only basic functionalities are tested All functional issues are tested Limited in scope Broader in scope Usually ran before check-in Ran after build is created
  8. 8. www.pavanonlinetrainings.com API Testing V/S Unit Testing
  9. 9. www.pavanonlinetrainings.com What is Web Service? • What is a Web Service: Web Service - service available over the web • Enables communication between applications over the web • Provides a standard protocol/format for communication • Why we use it? • Platform independent communication - using web services two different applications (implementation) can talk to each other and exchange data/information Order food Send order to Kitchen Food ready Serves food C l i e n t R e q u e s t A P I R e q u e s t A P I R e s p o n s e Client Server Web service API
  10. 10. www.pavanonlinetrainings.com
  11. 11. www.pavanonlinetrainings.com Difference between API & Web service 1. Web Service is an API wrapped in HTTP. 2. All Web Services are API but APIs are not Web Services. 3. Web Service might not perform all the operations that an API would perform. 4. A Web Service needs a network while an API doesn't need a network for its operation.
  12. 12. www.pavanonlinetrainings.com Components of Web Services : WSDL and UDDI • What is WSDL? • WSDL stands for Web Services Description Language, an XML-based language that describes Web services and how to access and locate them. • What is UDDI? • UDDI stands for Universal Description, Discovery and Integration. It is an open, Internet-based specification that offers directory service for storing information about web services.
  13. 13. www.pavanonlinetrainings.com
  14. 14. www.pavanonlinetrainings.com UDDI UDDI (Universal Description, Discovery and Integration)
  15. 15. www.pavanonlinetrainings.com Types of Web Services • There are mainly two types of web services.  SOAP web services. (Simple Object Access Protocol)  RESTful web services. (Representational State Transfer) • SOAP (Simple Object Access Protocol) – SOAP is a protocol which was designed before REST and came into the picture. The main idea behind designing SOAP was to ensure that programs built on different platforms and programming languages could exchange data in an easy manner. • REST – This was designed specifically for working with components such as media components, files, or even objects on a particular hardware device. Any web service that is defined on the principles of REST can be called a RestFul web service. A Restful service would use the normal HTTP verbs of GET, POST, PUT and DELETE for working with the required components.
  16. 16. www.pavanonlinetrainings.com SOAP Vs Rest "marshalling" refers to the process of converting the data or the objects into a byte-stream, and "unmarshalling" is the reverse process of converting the byte-stream back to their original data or object
  17. 17. www.pavanonlinetrainings.com HTTP V/S HTTPS What Is HTTP? HTTP stands for Hypertext Transfer Protocol. At it’s most basic, it allows for the communication between different systems. It’s most commonly used to transfer data from a web server to a browser in order to allow users to view web pages. It’s the protocol that was used for basically all early websites. What Is HTTPS? HTTPS stands for Hypertext Transfer Protocol Secure. The problem with the regular HTTP protocol is that the information that flows from server to browser is not encrypted, which means it can be easily stolen. HTTPS protocols remedy this by using an SSL (secure sockets layer) certificate, which helps create a secure encrypted connection between the server and the browser, thereby protecting potentially sensitive information from being stolen as its transferred between the server and the browser. The Main Difference Between HTTP and HTTPS
  18. 18. www.pavanonlinetrainings.com
  19. 19. www.pavanonlinetrainings.com API/Web service testing challenges 1. Initial Setup of API Testing 2. Updating the Schema of API Testing 3. Testing Parameter Combinations 4. Sequencing the API Calls 5. Validating Parameters
  20. 20. www.pavanonlinetrainings.com Web Service API testing tools
  21. 21. www.pavanonlinetrainings.com Web service/API Testing process
  22. 22. www.pavanonlinetrainings.com REST SERVICES
  23. 23. www.pavanonlinetrainings.com RESTful web services •RESTful web services REpresentational State Transfer  A service represents a resource that can be accessed from the web  Commonly makes use of different HTTP request methods to implement CRUD functions:  POST – Create new resource  GET – Retrieve resource  PUT – Update resource  DELETE – Delete resource
  24. 24. www.pavanonlinetrainings.com Different HTTP Methods • GET • POST • PUT • DELETE
  25. 25. www.pavanonlinetrainings.com S2 – Server Producer Database S2 – Server Producer HTTP Request S1 – Client Consumer HTTP Response HTTP Request 1) URI 2) Headers 3) Payload –JSON/XML HTTP Response 1) Status Code – 200 OK 2) Response Payload 3) String message Successful HTTP Methods C - Create → POST R - Retrieve → GET U - Update → PUT D – Delete → DELETE 1) Create an account →POST Call JSON/XML AccountID=1 AccountName=“Tom” Address=“London” Account Type =“Savings” 2) Get an account by ID/Name →GET Call URL → http://api/service/accounnt/1 Path Parameter Query Parameter Headers 3) Update an account →PUT Call Create + Update AccountID=1 AccountName=Tome Address = NewYork Account Type =Current 3) Delete an account →DELETE Call AccountID=1 AccountName=Tome Address Account Type
  26. 26. www.pavanonlinetrainings.com What is URI and URL
  27. 27. www.pavanonlinetrainings.com Examples - Demo • https://reqres.in/

×