Thursday, October 29, 2015

Groovy Scripting

10/29/2015

Groovy Scripting –

Types of Testing using SOAP UI

10/29/2015

JSON

10/29/2015

- JSON is a format, which is used to represent a data.

Data start with curly braces in JSON.

Tool- SOAP UI

10/29/2015:

- Current version of the tool is 5.2.0
-
Steps to start testing Web Service:


  1. Create Project
  2. Add WSDL web service url for the service that you wanted to test
Note:Generally basic level difference between SOAP and REST based SOAP UI tool
1. If the web service is a SOAP then it will have Interface, if it is REST based then it will have               service.
2. Inside Interface you will have Operations (SOAP web services)
    And in Service you will have Resource (REST based web services)
3.  Inside Operations you have Requests. And then Request will have methods inside it.
     And inside Resource you have Methods. And inside Method you will see Request.
4. The methods that are available in SOAP are mostly get and set. Here the operations are going and       getting back the information.
    But in REST, it would be GET, POST, PUT, Delete, Head, Options, Trace and Patch
5. In SOAP you have Request , End Point and Response . 
    In REST - you input parameters instead of Input request. Similar to SOAP UI you can also send         xml along with your message. Set it to POST method and include any kind of XML(media type           window..) that you wanted to send.
6. SOAP based web services only handles XML based formats in the request.
    REST based accepts data of format XML, HTML, JSON and Rawdata...

7 . Request and Response:
SOAP:
Request and Response of SOAP based on service follows standard xml structure. Soap Envelop, Soap Header and Soap Body

Soap Body in the Request - is user defined. '?' in the Body means where you could provide your input.

In the Request you could see POST that means, SOAP uses POST method every time during the request and REST has many methods to use.


REST:
Update the parameter value in the request and then click on play button to execute.
In the Response you will have four types of formats to view the Response - XML, JSON, Raw, HTML. If you don't see response in XML format then you could change the format to view accordingly.

JSON format - starts with curly braces. Inside braces, you have 'responseData' that is a root node and then 'results'.




8. Executing the request is simple, just click on the play button once the request xml or parameters are ready.




Wednesday, October 28, 2015

REST based Web Service


10/29/2015

- REST(Representational State Transfer)  relies on stateless, client server, catchable communication protocol.REST is architectural style for designing web services.

SOAP based Web Service

10/29/2015:

- SOAP(Simple object Access Protocol) is simple XML based protocol to let applications exchange information over HTTP(which is a Transport protocol)

- It has its own way of defining web service, it has its own standards.

- It is a communication protocol for communication between applications. Is a format for sending messages

- It is designed to communicate via internet

- SOAP is platform and language independent

- SOAP is based on XML

- It is simple and extensible. Allows you to get around Firewalls

- A better way to communicate between applications is over HTTP because HTTP is supported by all Internet browsers and servers. SOAP was created to accomplish this.
SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.

-


UDDI

10/28/2015

- Stands for Universal, Description, Discovery and Integration

- This allows organizations to register their web services in a uniform manner within a common directory, so clients can locate their web services and learn how to access them.

- It has directory service where businesses can register and search for Web Services

- It is directory of web service interfaces described by WSDL

- UDDI communicates via SOAP

- UDDI is currently handled by a group called OASIS. This was started by major companies like Micro Soft, IBM...where they included there web services and made it available to external vendor


- UDDI is Service Registry


WSDL

10/28/2015

- WSDL(Web Services Description Language) is XML based language for describing Web Services and how to access them. It defines a control between the producer and consumer of a SOA web service.

- Document written in XML. The document describes the Web Service. It specifies the location of the service and the operations (or Methods) the service exposes.

Major Constituents of a WSDL:


  1. Types
  2. Message
  3. Prototype
  4. Binding

Before proceeding with the WSDL, we have to check what details are available in WSDL.



Note: Looks like every web service(Ex: Calculator, GoogleSearchEngine...) has WSDL web service url, using which you could test the web service. So WSDL could be found as URL.

XML

10/28/2015

- eXtensible Markup Language
- is a mark up language much like HTML
- XML was designed to transport and store data, with focus on what data is, while HTML was designed to display data with the focus on how data looks
- XML tags are not predefined you have to define your own tags
- XML is designed to be self descriptive
- Every XML has start and end tag. In below ex 'Note' is Root node
-

Ex:
<Note>
<To>Jack</To>
<From>Srikanth</From>
<Heading>Reminder</Heading>
<Body>Dont forget me this weekend</Body>
</Note>



Web Service

10/28/15:

- Web service is considered as component testing in testing perspective
- Component level testing - Web Services include

1. Understanding WSDL
2. Mock Services based testing
3. Service Level Performance Testing

Note: Most of the free tools does not completely support Performance testing, due to tool limitations

- Web Service Testing with Quality of Services(QoS) - Web Services Security Testing
1. Service access is restricted using various policies (security, throttling)
2. WS-Security
3. WS-RM



- Web Services are software applications that can be:
1. Published using open standards(like XML or WSDL)
2. Searched/Located using Open statndards (like SOAP)
3. Invoked by other applications using open standards
4. Described using Open standards
5. Can be accessed on Internet/Intranet/extranet
6. use XML as language of communication
7. are connected by loosely coupled connections

Ex: Calculator Class deployed in a server and exposed as a Web Service


- Note: Web services could be with authentication or without. If you wanted to keep for specific you can have it authenticated only for those users and if you wanted make it open source then you can remove authentication on the web services. There are 3 types of web services when it comes to authentication.


- Webservices could be found in the following website:

http://soatest.parasoft.com/services/

SOA

10/28/2015:

SOA
- Makes change Easier
- Easy to Assemble and recongifugure (Software, Hardware and Networking)
- Work on Web services Modularly, Assemble any way you want to get business out of it. Save time and Money
-  Add existing blocks, new blocks and someone else blocks to create new business. That help your business grow
Ex: Expedia site, where there create new services to get the information from different websites thus creating new business
- Here the following diagram tells us how to perform SOA testing, ESB is Enterprise Service Bus: It is the tool that stays in the middle, holds everything. It is a middle to track back end system with Frond end system. It takes care of Data conversion, transformation and execution





Evolution of SOA:






Advantages of SOA:

1. Loose coupling: It reduces the dependencies between two applications.
Ex: When FB application goes down it does not effect Candy Crush even though they are tagged by Web Service.
2. Composable:  Collection of the services can be coordinated and assembled to form composite service.
Ex: Expedia page, where user gets benefited as the lowest price details are pulls from different website and put in front of customer
3. Reusability: Logic is divided into services with the intention of promoting reuse
4. Interoperable: Service enable applications to communicate irrespective of the technology and platform.
Ex: Application developed on Java run on Linux platform can communicate with an application developed in Dot Net which runs in Windows platform