Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts

Showing posts with label SOAP UI. Show all posts
Showing posts with label SOAP UI. Show all posts

Similarities and Difference between SOAP and REST

In this article, we will try to understand what SOAP and Rest Services are discussing the similarities and differences in between the two. I have tried to consolidate the basic concept to understand what are SOAP and rest services.

Working for the Same Cause - SOAP and Rest both are used to access Web Services.

What do they stand for?

SOAP - Simple Object Access Protocol
REST - REpresentational State Transfer


What do they mean?

SOAP

  • SOAP is a standards-based Web services access protocol.
  • SOAP relies exclusively on XML to provide messaging services.
  • SOAP was developed by Microsoft.
  • SOAP is a standardized format and has defined various standards for messaging, security, metadata exchange specification and so on.
  • SOAP is highly extensible and also flexible enough to use only those standards which are required for the web services. E.g.: for a web service free to public, it is not required to define the security and authentication for web service.
  • SOAP Based Web Services are defined in WSDL(Web Services Description Language)
  • In case of invalid request, SOAP Response provides details of the error with error code, which helps user to identify the error in the request and correct the same.
  • SOAP client is tightly coupled to the server with rigid contract between client and server, Changes in either of client or server side needs to be communicated to counterparty for web services to work.

REST

  • REST uses URL instead of using XML to make request. Since REST uses URL, REST client is more like a browser.
  • REST uses GET, POST, PUT, and DELETE to perform tasks.
  • We can have the response in required format for e.g. in CSV, JSON, plain text, and XML format while using REST 
  • WADL is the REST equivalent of SOAP's Web Services Description Language (WSDL)
  • REST does not have large number of standards like SOAP.
  • REST is not a protocol but an architectural style.
  • A representation of a resource must be stateless, cacheable.
  • REST requires less bandwidth and resource than SOAP.

SOAP Advantage over REST

  •  REST services inherit security measures from the underlying transport whereas we can define our own security in SOAP. In terms of security, SOAP is assumed to be more safe compared to REST Works well in distributed enterprise environments
  • Is more standardized and has higher extensibility in form of WS* Standard.
  • Allows better error handling in the response from server.


REST Advantage over SOAP

  • REST is protocol independent.
  • While SOAP only supports XML, REST supports different format like text, JSON, XML.
  • REST requires less bandwidth and resource than SOAP.
  • Rest is more lightweight

Building base in WebServices – Questions and Answers

In last few articles, we discussed about the challenges inIntegration testing and have briefed the concept of web services.

In this article, we will explain how web services are used for integration testing. I will break this article in short questions and answers to easily understand the concepts:

  • What is Integration testing? – Validating Integration or connection between multiple components, modules or systems

  • What are the different architecture options available for Integration? – The common architecture options are using SOA, ESB or EAI architecture.

  • What are web services?  - A Web service is a URL-addressable resource returning information in response to client requests. Web services allow data exchange between applications in a platform independent manner. SOA are developed on web services using standard description (WSDL), discovery (UDDI) and messaging (SOAP).

  • How are Web Services useful for Integration testing? - Web Services are services used to have seamless and smooth integration of one software with software over intranet or intranet. Web Services uses SOAP Protocol to communicate between the software which is XML over http protocol.

  • What is WSDL? – Operations in a web services are described in XML format with the Web Service Description Language (WSDL). The WSDL consists of the URL for the web service, the methods in the web services, input parameter types and the return types of the web service methods.

  • What is UDDI?  - Web services can be published and located using the Universal Description, Discovery and Integration (UDDI) based registry of services.

  • What is SOAP? – SOAP stands for Standard Object Access Protocol. SOAP is used as messaging standard for communicating with the web service. Wrapped in a SOAP Envelope, Message can be delivered across network using different protocols.

  • What are top Challenges in testing web services?  - The major challenges in testing web services are:

o   Absence of a user Interface – Testing web services manually is a difficult task due to absence of user interface. To work with and testing web service, tester needs to have knowledge of specific tool .e.g.: Soap UI or jmeter and coding knowledge , e.g.: Groovy script
o   Actual Size of end User(s) for Internet Web Services – Performance testing should be done as early to validate proper response on soap request is received with varying load on web services. This again requires technical as well as tool knowledge and also identifying the expected load on web services is challenging.
o   Another challenge is maintaining different versions of Web Services as the old version of API are consumed. 

  • What are the different testing tools to test web services? Some of the  testing tools to test web services are :

o   Jmeter
o   SOAP UI
o   Examine

Understanding the SOAP Part of SOAPUI

 In this series of article, we will discuss on frequently asked question in Soap UI, we may know how to test using SOAP UI, but at times, we do not have answers when explaining what the terms in SOAP means.  In the first article in the series of  learning SOAPUI through Question/Answers, we will discuss on the SOA, What a WSDL is , what a SOAP is and how service provider , service User and UDDI are related for a SOAP Web Service

SOAP UI is used to test Web Services and SOA architecture, but many of us do not have words to explain what a web service is or what SOA architecture is. So the first question is what are SOA Architecture and Web Service.


Answer:  SOA stands for Service Oriented Architecture. Application components provide services and interact with applications and other services through asynchronous message-based communication model in this architecture.

A service is a unit of work done by a service provider to achieve desired end results for a service consumer. SOAs are comprised of highly interoperable services. Web Service is a service that supports web standards. Web Services exposes the functionality and methods in WSDL format file. WSDL stands for Web Services description language.
Once a web services is created, it is published in the Universal Description, Discovery, and Integration (UDDI) registry repository.

SOAP (Simple Object Access Protocol) is an XML-based protocol to exchange messages between a requester and a provider of a Web Service. This protocol specifies conventions for packaging a message and its processing rules.





SOAPUI uses the SOAP Protocol to access response for a request for a SOAP Web services request. To understand how SOAPUI works. There are WSDL available for web services on UDDI; SOAP protocol specifies conventions for packaging a message and its processing rules. For e.g.: there are Web Services available on the UDDI with exposed functionalities and methods in WSDL files for the end users of the web services. Using SOAP UI, we request for the methods. On executing the request, we get a response based on input in the request.

Creating first test in Soap UI/Ready API


In this article, We will discuss on how to create a test in SOAP UI. Before starting, we need to discuss what SOAP UI is.  SOAP UI is web service testing application for SOA and Rest. Below is the step by step process and each step is described in detail to as to enable user able to create first tests in SOAP UI/ Ready API. We will discuss on following in this article                                                   

1.   Creating first project in SOAP UI

2.   Creating a test suite.

3.   Adding test case in the test suite

4.   Adding test steps to test case.

5.   Executing the test case.



1.   Creating first project in SOAP UI


a.    A new project can be created using menu Option File>Create a new Project or pressing Ctrl + shift + N.


b.   A new project Window appears to create a new project. Select the required option. Since in this example, we are creating a project from WSDL file, I have selected the option to import project from a WSDL definition (SOAP). Click on Ok.

c.   In New SOAP Project, Provide the URL /Path of WSDL and Name of the Project

d.   User can opt for creating sample request for operations in the WSDL and creation of a test suite for the Project.


2.   Useful  Setup information at Project level


a.   There are some project specific properties. Together with Project Properties, we can define custom properties that are used across test suites or requests in the test.
b.   We can define the endpoints and custom properties of different environment at project in case we have different environment on which we need to test the application.

c.   We can define the users in WSS-configuration to use the username/Password to access operations in the soap.


3.   Once a project is created, we can create a test suite in the Project.  A test suite contains a collection of test cases. Each test case consists further of test step. There can be multiple test suites in the Project. We can provide custom properties at the test suite similar to project and can set the environment to run the test suite.

4.   Inside a test suite are test cases. At test case level we define the test steps which are created to be executed. Below are some of the useful test steps in a test case:


a.   Data Source – To create a data driven test in soap UI, We create a data source.
b.   Data Source Loop – To loop through the steps in the test case from target step.
c.   Properties – Sets properties to be used in the test.
d.   Groovy Script – Groovy script to generate output from a script
e.   SOAP request – Adding a soap request in the test
f.    Property transfer – Transferring property value from the response to  data sink
g.   Data Sink – transferring value from test to external file.
h.   Delay – Delaying the execution by millisecond

5.   In Soap request, we can define assertions in the test to validate if the response from the request is valid and as expected.