Design And Implementation Of Web Service Testing Framework Mit Template
-
Upload
reswin -
Category
Technology
-
view
2.215 -
download
1
description
Transcript of Design And Implementation Of Web Service Testing Framework Mit Template
Department of Information & Communication Technology ,MIT Manipal
A.RESWIN RODRIQUEZReg No. 070927009
M.Tech. Network Engineering Dept of Information & Communication Technology
Manipal Institute of Technology.
DESIGN AND IMPLEMENTATION OF WEB SERVICE TESTING FRAMEWORK
Under the Guidance of
Balachandra Sujit Kumar Chakrabarti,Senior Lecturer, Senior Scientist,Manipal Institute of Technology, Philips Electronics India Ltd,Manipal. Bangalore.
E-mail:[email protected].
Department of Information & Communication Technology ,MIT Manipal
What is a web service?
Web services are software's that are designed to provide interoperable machine to machine communication over a network.
Web services are also called programmable web.
The web service client parses the response xml and extracts the necessary information from it, as xml are well structured.
A machine doesn’t care about layout and styling. Machines basically just need the data.
Department of Information & Communication Technology ,MIT Manipal
Web Service contd.When a machine or web service client makes GET on a resource, it will ask for the machine readable one.
When a browser makes GET on a resource for a human, it will ask for the human readable one.
Eg:A part of the response from a web service to find the details of a book would look like
<productname>RESTful Web service</productname> <catalog>Book</catalog> <author>Lenard and Sam</author>
<releasedate>01,may2007<releasedate>
Normal applications are not distributed, but web services are distributed.
Department of Information & Communication Technology ,MIT Manipal
RESTful Web servicesREST stands for Representational State Transfer.Its is an architectural style of implementing web service.In REST all the resources are uniquely identified by a URI.It has uniform form Interface (CRUD operation).CRUD – CREATE,READ,UPDATE,DELETE.In RESTful service the interactions are stateless.For example the services expose by the RESTful web service are described in a machine process able language called WADL (Web Application Description Language).
Department of Information & Communication Technology ,MIT Manipal
RESTful Web services Example
A RESTful web service is a simple web service implemented using HTTP and with the principles of REST.
It is a collection of Resources.
For example if a RESTful web service presenting a collection of cars for sale might have the URI as “http://example.com/resources/cars”.
If the service uses the car registration number as the ID then a particular car might be present in the collection as “http://example.com/resources/cars/yxz123”.
Department of Information & Communication Technology ,MIT Manipal
WADL
WADL stands for Web Application Description Language.
WADL is a Resource centric description language.
It is a well formed XML file.
WADL provides a machine process-able description of the services exposed by the web service.
Department of Information & Communication Technology ,MIT Manipal
WADL Example<?xml version="1.0"?><!-- This is a Example of a WADL . -->
<application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:html="http://www.w3.org/1999/xhtml"> <resources base="https://api.del.icio.us/">
<resource path="Search"> <method href ="#end"/> </resource>
</resources >
<!-- Methods--> <method name="GET" id="end">
<request> <query_variable name="id" type="xsd:int" required="true"/>
</request>
<response> <representation mediaType="application/xml" element="result"/> <fault id="SearchError" status="400"
mediaType="application/xml" element="error"/> </response>
</method>
</application>
Department of Information & Communication Technology ,MIT Manipal
Connectedness
Connectedness means the ability to navigate from one resource to the other by following the links. The links are the URI of the resource that connect one resource to the other.
Placement of the URI should be intuitive.
Department of Information & Communication Technology ,MIT Manipal
Connectedness Example
Suppose R1,R2,R3 are resources.
R1,R2,R3 have unique URI representing a resource.
If R1,R2,R3 are reachable following the URI from the base resource R, then web service is connected.
Department of Information & Communication Technology ,MIT Manipal
Connectedness-Testing
R1,R2,R3,R4 are resources.
A graph with URI of the resources as Nodes and connectivity between the resources as their Edges.
R
R1 R2
R3
R4
Department of Information & Communication Technology ,MIT Manipal
Connectedness-Testing
A reference list is a collection of all URI present on a web service.
Check if all the URI’s present in the reference list are present in the graph.
Department of Information & Communication Technology ,MIT Manipal
Problem of Reference List Generation
Reference List is generated from the WADL.
WADL document does not contain the sufficient information. Whether a resource already exist or not.
i.e. are the resources already posted?
Department of Information & Communication Technology ,MIT Manipal
Insufficient Information in WADL
WADL specification does not contains the necessary information to test the connectedness of the RESTful web service.
Information about already posted resources are not present in the WADL specification.
Certain changes have to be incorporated into WADl Document.
Department of Information & Communication Technology ,MIT Manipal
Enhancement to WADL
List of proposed changes to WADL.
‘target’ element is added under ‘method’ element.
The ‘target’ element has an attributes called ‘id’.
• <target id = “#user” />• <target id =”#article” />
Department of Information & Communication Technology ,MIT Manipal
Enhancement Contd..
‘resource’ element adds an attribute called ‘id’ which corresponds to the ‘id’ attribute of ‘target’ element.
• <resource path = “eblog/{x}” id = “#user>
Department of Information & Communication Technology ,MIT Manipal
Example :eblog WADL <?xml version="1.0"?><application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:html="http://www.w3.org/1999/xhtml"> <resources base="http://localhost:8282/"> <resource path="eblog" id = "#blog"> <method href ="#Postblog"/> </resource> <resource path="eblog/{x}" id = "#user"> <method href ="#Postarticle"/> </resource> <resource path="eblog/{x}/{y}" id = "#article"> </resource> </resources > <!-- Methods--> <method name="POST" id="Postblog"> <request> <query_variable name="user" type="xsd:string" value ="{x}" required="true"/> <target id ="#user"/> </request> <response>
<representation mediaType="application/xml" element="result"/> <fault id="SearchError" status="400" mediaType="application/xml" element="error"/> </response> </method> <method name="POST" id="Postarticle"> <request> <target id ="#article"/> </request> <response> <header> <field name = "location" value = "eblog.com/{x}/{y}"/> </header> <representation mediaType="application/xml" element="result"/> <fault id="SearchError" status="400" mediaType="application/xml" element="error"/> </response> </method></application>
Department of Information & Communication Technology ,MIT Manipal
Implementation Approach
Start
wadlWADL Document
ResultAnalyze WADL (wadl)
If (Result = pass)
RefListGenerateRefernceList(wadl)
ResultTestConnectivity (wadl, RefList)
Output Result
Stop
Yes
No Abort
Department of Information & Communication Technology ,MIT Manipal
WADL Analyzer
A WADL analyzer is a program that verifies if it contains the Proposed changes.
Only if the output of the WADL analyzer is “pass” then the WADL document will be the input of the Reference List Generator.
Department of Information & Communication Technology ,MIT Manipal
Automatic Reference List Generator
The Reference List Generator would make POST operations depending upon the WADL specification.
Collect the URI of the resource from the post response or from query string of the resource.
Augmented WADl Reference List
Auto Reference List Generator
Department of Information & Communication Technology ,MIT Manipal
URI Navigator
The output of the Reference List Generator is given as the input to the URI navigator (i.e. a list of URI).
The URI Navigator is a program that performs GET operations starting from the base URI and then forms a list of URI’s Navigated.
Navigated URI List is compared with the Reference list to check if the URI’s are reachable.
Department of Information & Communication Technology ,MIT Manipal
THANK YOU