Testing > Soap UI >> Soap UI Intro Views : 8093
Rate This Article :

SOAP UI Mock Service

Introduction

SoapUI is a free and open source cross-platform Functional Testing solution. SoapUI allows you to easily and rapidly create and execute automated functional, regression, compliance, and load tests. In a single test environment, SoapUI provides complete test coverage and supports all the standard protocols and technologies.

Here we can see, how we can use the SoapUI tool to work disconnected environment.

Problem Statement

In large scale project, multiple teams will work on the various components like services, SQL server, .Net or Java Development.

One team writing up the Services and respective service data are consumed by other teams either .Net based code or java based code. The consumer always depends on the data from the service team.

In order to avoid the dependency and work in a disconnected environment, SoapUI can be used.

Prerequisites

1.     SoapUI 4.5.2

2.     WSDL file

3.     Sample XML data

SoapUI Project Creation

Install the SoapUI open source tool in Windows (it is cross platform tool). In the below example the SoapUI4.5.2 is used.

The below steps explains how to create the Soap UI project and Mock services. Also it provides the details about how to create the mock service URL.

Step 1: Open the Soap UI and select “New SoapUI Project” option in the File menu

Soap UI

Step 2: Enter the project name (SoapUIProjectDemo) and Browse the WSDL file (D:\SoapUIWSDL.wsdl), then select OK.

SoapImage2.jpg

Step 3:  Now we can see the list of methods exposed in the Services. Also we can define the

Customized name for the path and the port Number.  In the below example Methods  names are,

·         SoapUITest1

·         SoapUITest2

Port Number is 8088 and the path is given as “mockSoapUIWSDLBinding

Since we will be using Mock service to read the data in our code, enable “Adds the Mock Services enpoint to the mocked interfaces” checkbox.

SoapImage3.jpg

Step 4: Enter the Mock Service name (SoapUIWSDLBindingMockService)

SoapImage4.jpg

Step 5: The request and response structure of the WSDL are created as a project. The mock    service contains the response XML structure.

SoapImage5.jpg

Step 6: Open the Mock service response and replace the response data with the sample XML file with data received from the Service development team.

Soap UI Xml

Step 7: Right Click on the Mock Service Project(SoapUIWSDLBindingMockService) and Select the option “Add Endpoint to Interface

SoapImage7.jpg

It will give the end point URL as shown below which comprises the PC\Desktop\Server Name (PCXXXXX), Port number (8088) and endpoint name (mockSoapUIWSDLBinding)

SoapImage71.jpg

Step 8:  As a final step, Right click on the Mock service Project (SoapUIWSDLBindingMockService) and select “Start minimized” or “Restart” option. This will run the Soap UI mock service project with the sample XML data.

SoapImage8.jpg

Now we can use this URL (http://PCxxxxxx:8088/mockSoapUIWSDLBinding ) in the application (.Net\Java) to consume the data from the sample XML as a mock service.

Benefits

1.       It will help service consumer (.Net\java) to develop the application independently.

2.       The data dependency can be reduced.

3.       It helps to change the data in the sample XML and test multiple scenarios.

About Author
Jeevarathinam V
Total Posts 1
Comment this article
Name*
Email Address* (Will not be shown on this website.)
Comments*
Enter Image Text*
   
View All Comments
sejal
hi,we provide online training & video tutorial for soapui for free videos refer http://soapui-tutorial.com/soapui-tutorial/introduction-to-webservices/
  Privacy   Terms Of Use   Contact Us
© 2016 Developerin.Net. All rights reserved.
Trademarks and Article Images mentioned in this site may belongs to Microsoft and other respective trademark owners.
Articles, Tutorials and all other content offered here is for educational purpose only and its author copyrights.