hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

API Testing using SOAP UI

What is an API ?

API is an Application Programming Interface. In Software development, every application will have three distinct layers :

  1. Presentation layer (or User Interface)

  2. Business layer ( Where API testing is performed)

  3. Database layer

where API Testing is done on the Business layer .API enables applications or software's to communicate with each other or exchange information between the applications without human intervention using standard formats like XML and JSON

Example : When we are booking flight tickets through some travel website. Using the site online form, we will fill all the necessary information like Departing from, going to, Departing Date, Number of Adults etc. and when we click on show flights , we will get information from various flights, and we can choose and we can book the ticket.

Here we will get a question how particular website is gathering the information from various vendors?

Here comes the API, with the help of API webservice an application interacts with other applications over the network and gathers the information and displays the results to the end users.


What is API Testing ?

API Testing is a type of software testing where the business layer of an application is tested to determine whether they are meeting the functionality, reliability, performance and security of an application.

Advantages of API Testing :

1. Finding bugs at early stage of software development :

Since testers will have early access to the application without Graphical user Interface, we can find defects and errors at the early stages so that developers can resolve the issues at early stages before they impact to the GUI.

2. Language Independent:

In API testing, data is exchanged using XML or JSON format, since data transferring is completely language independent, So we can use any programming languages like Java, Java Script, Python, Ruby, PHP etc.

3. Effective use of time:

API Testing consumes less time compared to GUI testing , because in UI testing most of the time is spent on loading and rendering the web pages.

4. API testing is easily integrable with GUI testing.


Types of Web Services:

  1. SOAP

  2. REST


​SOAP

REST

SOAP stands for Simple Object Access Protocol

REST stands for Representational State Transfer

SOAP is a protocol

Rest is an architectural style

Since SOAP is a protocol , It follows standard rules for communication between client and server

Rest doesn't follow any strict standard rules for communicating between client and server

SOAP has WS-security and SSL(Secures Socket Layer) and it also has built in ACID compliance.

REST supports https and SSL

SOAP cannot make use of REST

REST can make use of SOAP

Uses XML format for exchanging the data

Uses different formats like XML, JSON, Plain-text, HTML, YML.

SOAP requires more bandwidth

REST requires less bandwidth

There are various API Testing tools in the market like

  1. SOAP UI (Open Source)

  2. Ready API

  3. POSTMAN(Open Source)

  4. Katalon Studio

  5. REST- Assured

  6. JMeter etc.

Lets learn about SOAP UI:

  1. SOAP UI is an open source API Testing tool.

  2. Using SOAP UI we can execute functional and non-functional (Performance, Security) tests.

  3. To test the API's, SOAP UI supports all the standard protocols like

  4. SOAP(Simple Object Access Protocol)

  5. REST (Representational State Transfer)

  6. HTTP(Hyper text transmission protocol)

  7. HTTPS ( Hyper text transmission protocol secured)

  8. AMF ( Action Message Format)

  9. JMS ( Java Messaging Service)

  10. JDBC( Java Database Connectivity)

  11. SOAP UI can be Integrated with maven, Jenkins, Junit, Apache etc.

Download SOAP UI free version from the following link

https://www.soapui.org/downloads/soapui/


Let's take a simple Calculator API to test in SOAP UI which has WSDL document.

What is WSDL ?

WSDL stands for Web Service Description Language. It is a XML document which describes the functionality of SOAP based web service.

For Example : If we take calculator API , WSDL document of calculator API describes how API works and gives the information required to connect to the webservice and we can use all the functionalities provided by the API

WSDL URL for Calculator API -- http://www.dneonline.com/calculator.asmx?wsdl

Step 1 :

Open SOAP UI , Go to File and select New SOAP Project and you will see the window as shown below .

Step 2:

Paste WSDL as show above in the Initial WSDL and press Ok. You will see the project structure as shown below.


Step 3:

Click on Add , and double click on SOAP request , which opens the following window




Step 4 :

Enter the two integer values in the place holders and click on green button and you should be able to see the response , If response is 200 then the request has been submitted successfully.


Click on XML tab you will be able to see the result for addition of two numbers.


That's it you have done your first API request. Perform the same actions on Divide, Subtract, Multiply requests and check the response.

67 views0 comments

Recent Posts

See All