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



Tuesday, September 8, 2015

Notes


SOAP UI
- http://www.soapui.org/downloads/soapui/open-source.html
- Parasoft
- For tutorials:

http://www.soapui.org/getting-started/10-tips-for-the-soapui-beginner.html?utm_source=soapui&utm_medium=starterpage&utm_version=1.1



  • Scripting supported by SOAP UI(Free ware) are Java Script and Groovy Script
  • SOAP UI does Web service testing
  • SOAP UI Pro is the upgraded version(not free): The difference is in free version you have to write Javascript or Groovy script in order to obtain the Pro features.
  • SOAP UI has Easy to use Graphical Interface. Other tools that are in market - Lisa, HP service testing etc does not have great graphical user interface.
  • SOAP UI also does SOA testing

SOA: Is a computer systems architectural style for creating and using business processes, packaged as services, through their life cycle.
  • SOA - Service Oriented Architecture. SOA is not technology but an architectural approach. Webservices is one of the means of achieving SOA.
  • Web Service Testing and API testing are one and the same
  • SOA has 3 components - Service Provider( Creating API), Service Registry( WSDL are available in Service Registry or WSDL's are published to Service Registry. The registry gives the description of web service, what it is capable of doing. How you can access Web Services) and Service Customer(Customer will look for Paid or non Paid services. He will need to login and look for his services. Request->Invoke(using the WSDLfile or WADL)->
WADL - is Web application description language. This is for other type of service REST based architectural web services. First type of web service is SOAP UI. Service Registry has url of REST based web service

Service Registry(Ex: UDDI) - Is the only place where you get what are the different types of Web  services available and how you can access them. Who maintains Service Registry - Apps dev team maintains it. UDDI is Real time Service Registry. There are also Public Service Registries that could be accessed by anybody.

  • SOA marks as end of Monolithic applications and marks the beginning of more flexible and adaptable business process centric applications.

  • Service could be of any type - Web Service, Database management service....
  • While exposing to the customer, Web Services are not exposed but functionalities are being exposed. Once companies have designed there applications they will try to expose it as web services
  • API testing and Web service testing is one and the same, API's are being exposed as web services that's it.
  • Developer creates an API - Application Programmer interface and try to expose it with the help of web services to the customer. If the web service is SOX(SOAP based web service) then Developer exposes the API  using WSDL(Web Service Description Language)
  • Service customer raises a request using WSDL or WADL(that could be found in Service Registry) for a web service and Service Provider will provide the response, so Service Registry has nothing to do here.
Example of Web Services:
- Candy crush with Facebook updates- Means customers of Candy Crush could play and update there scores in there Facebook account. Here Facebook has Rest based web services, that helps Candy crush to access Facebook anywhere and update its score.
- Travel website is also one kind of web service as customer enters his flight details and click search button, the website will list down flight details from various websites, that mean same search query is used to retrieve data from various websites in parallel.


Below diagram explains you how the execution happen in Web Services. 
Note: All the white circles are "SOAP"




SOAP UI Panels:




- 5.2 version is the latest version for SOAP UI tool

-  Download SOAP UI:

http://www.soapui.org/downloads/soapui/open-source.html


- SOAP UI is supported in Mac too.

- Parasoft Soatest -- is a Service Registry that has list of Web Services. Where you could find the urls of Web Services. When you are working on SOAP UI tool, to test that fucnationlity of web service you need to know the WSDL of that webservice(like Googleserach engine or Calculator...). Once you get the WSDL(could get it from Parasoft site mentioned below), provide that url in the SOAP UI to proceed further.

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

Protocols:

- What Protocols does Webservices use?

SOAP based services relied on SOAP protocol

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

In all cases HTTP protocol is used.