Showing posts with label Web Service Testing. Show all posts
Showing posts with label Web Service Testing. Show all posts

Sunday, June 14, 2020

API Testing

API:

API stands for Application Programming Interface. API acts as an interface between two software applications and allows the two software applications to communicate with each other. API is a collection of software functions which can be executed by another software program

API Testing
API testing is a type of software testing that involves testing APIs directly and also as a part of integration testing to check whether the API meets expectations in terms of functionality, reliability, performance, and security of an application. In API Testing our main focus will be on Business logic layer of the software architecture. API testing can be performed on any software system which contains multiple APIs

common API Testing Types
  • Unit testing
  • Functional testing
  • Load testing
  • Runtime/ Error Detection
  • Security testing
  • UI testing
  • Interoperability and WS Compliance testing
  • Penetration testing
  • Fuzz testing

common protocols used in API Testing
  • HTTP
  • REST
  • SOAP
  • JMS
  • UDDI
Difference between API and Web services?
  • Web services:
1. All web services are APIs
2. All web services need to be exposed over web(HTTP)
3. A Web service uses only three styles of use: SOAP, REST and XML-RPC for communication
4. A Web service always needs a network to operate
  • APIs:
1. All APIs are not web services
2. All APIs need not be exposed over web(i.e. HTTP)
3. API uses multiple ways for communication e.g. DLL files in C/C++, Jar files/ RMI in java, Interrupts in Linux kernel API etc.
4. APIs don’t need a network for operation
Soap- SOAP stands for Simple Object Access Protocol. It is an XML based messaging protocol. It helps in exchanging information among computers
Rest API REST stands for Representational State Transfer. It is a set of functions helping developers in performing requests and receive responses. Interaction is made through HTTP Protocol in REST API.

Challenges faced in API testing
  • Selecting proper parameters and its combinations
  • Categorizing the parameters properly
  • Proper call sequencing is required as this may lead to inadequate coverage in testing
  • Verifying and validating the output
  • Due to absence of GUI it is quite difficult to provide input values

commonly used HTTP methods
GET: It enables you to retrieve data from a server
POST: It enables you to add data to an existing file or resource in a server
PUT: It lets you replace an existing file or resource in a server
DELETE: It lets you delete data from a server
PATCH: It is used to apply partial modifications to a resource
OPTIONS: It is used to describe the communication options for the target resource
HEAD: It asks for a response identical to that of a GET request, but without the response body

difference between PUT and POST methods
PUT and POST methods are sometimes confused in regards to when each should be used. Using POST request, our intent is to create a new object on the server whereas with PUT request, our intent is to replace an object by another object

Components of an HTTP request
HTTP request have five components. These are:
1.       Action showing HTTP method like GET, PUT, POST, DELETE.
2.       Uniform Resource Identifier (URI): URI is the identifier for the resource on the server.
3.       HTTP version: Indicate the HTTP version like- HTTP V1.1.
4.       Request Header: Request Header carries metadata for the HTTP request message. Metadata could be a client type, format supported by the client, format of a message body, cache setting etc.
5.       Request Body: Resource body indicates message content or resource representation.

Error codes for request
  • 200 ok
  • 201 created
  • 204 no content
  • 400 bad request
  • 403 forbidden
  • 404 not found
  • 405 method not allowed
  • 409 conflict
  • 500 internal server error

API Testing Tools
·         Postman
·         Tosca
·         SOAP UI
·         UFT
·         Selenium



Wednesday, April 27, 2011

Web Services Concept

Web Service:
Web services (sometimes called application services) are services (usually including some combination of programming and data, but possibly including human resources as well) that are made available from a business's Web server for Web users or other Web-connected programs. Providers of Web services are generally known as application service providers.
The term Web services describes a standardized way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. XML is used to tag the data, SOAP is used to transfer the data, WSDL is used for describing the services available and UDDI is used for listing what services are available. Used primarily as a means for businesses to communicate with each other and with clients, Web services allow organizations to communicate data without intimate knowledge of each other's IT systems behind the firewall.
In Simple Term,
  •         Web services are application components
  •         Web services communicate using open protocols
  •         Web services are self-contained and self-describing
  •         Web services can be discovered using UDDI
  •         Web services can be used by other applications
·         XML is the basis for Web services
Advantage of Web Service
  • Web Services are platform-independent and language-independent, since they use standard XML languages. This means that my client program can be programmed in C++ and running under Windows, while the Web Service is programmed in Java and running under Linux.
  • Most Web Services use HTTP for transmitting messages (such as the service request and response). This is a major advantage if you want to build an Internet-scale application, since most of the Internet's proxies and firewalls won't mess with HTTP traffic (unlike CORBA, which usually has trouble with firewalls).
Disadvantages of Web Service:
  • Overhead. Transmitting all your data in XML is obviously not as efficient as using a proprietary binary code. What you win in portability, you lose in efficiency. Even so, this overhead is usually acceptable for most applications, but you will probably never find a critical real-time application that uses Web Services.
  • Lack of versatility. Currently, Web Services are not very versatile, since they only allow for some very basic forms of service invocation. CORBA, for example, offers programmers a lot of supporting services (such as persistency, notifications, lifecycle management, transactions, etc.). Fortunately, there are a lot of emerging Web services specifications (including WSRF) that are helping to make Web services more and more versatile.

How Does it Work?

The basic Web services platform is XML + HTTP.
XML provides a language which can be used between different platforms and programming languages and still express complex messages and functions.
The HTTP protocol is the most used Internet protocol.
Web services platform elements:
  • SOAP (Simple Object Access Protocol)
  • UDDI (Universal Description, Discovery and Integration)
  • WSDL (Web Services Description Language)
What is SOAP?
SOAP is an XML-based protocol to let applications exchange information over HTTP.
Or more simple:
  •         SOAP is a protocol for accessing a Web Service.
  •         SOAP stands for Simple Object Access Protocol
  •         SOAP is a communication protocol
  •         SOAP is a format for sending messages
  •         SOAP is designed to communicate via Internet
  •         SOAP is platform independent
  •         SOAP is language independent
  •         SOAP is based on XML
  •         SOAP is simple and extensible
  •         SOAP allows you to get around firewalls
  •    SOAP is a W3C standard
What is WSDL?
·         WSDL is an XML-based language for locating and describing Web services.
  •          WSDL stands for Web Services Description Language
  •          WSDL is based on XML
  •          WSDL is used to describe Web services
  •          WSDL is used to locate Web services
  •          WSDL is a W3C standard
What is UDDI?
UDDI is a directory service where companies can register and search for Web services.
  • UDDI stands for Universal Description, Discovery and Integration
  • UDDI is a directory for storing information about web services
  • UDDI is a directory of web service interfaces described by WSDL
  • UDDI communicates via SOAP
  • UDDI is built into the Microsoft .NET platform
Type of uses of Web Service
1.      Reusable application-components.
There are things applications need very often. So why make these over and over again?
Web services can offer application-components like: currency conversion, weather reports, or even language translation as services.
2.      Connect existing software.
Web services can help to solve the interoperability problem by giving different applications a way to link their data.
With Web services you can exchange data between different applications and different platforms.
Why Web Services
  •        A few years ago Web services were not fast enough to be interesting
  •                  Interoperability has Highest Priority
When all major platforms could access the Web using Web browsers, different platforms could interact. For these platforms to work together, Web-applications were developed.
Web-applications are simple applications that run on the web. These are built around the Web browser standards and can be used by any browser on any platform.
  •      Web Services take Web-applications to the Next Level
By using Web services, your application can publish its function or message to the rest of the world. Web services use XML to code and to decode data, and SOAP to transport it (using open protocols). With Web services, your accounting department's Win 2k server's billing system can connect with your IT supplier's UNIX server.

This article is contributed by “Sudhir Patil”. Thank you.