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
Step 2: Enter the project name (SoapUIProjectDemo) and Browse the WSDL file (D:\SoapUIWSDL.wsdl), then select OK.
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.
Step 4: Enter the Mock Service name (SoapUIWSDLBindingMockService)
Step 5: The request and response structure of the WSDL are created
as a project. The mock service
contains the response XML structure.
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.
Step 7: Right Click on the Mock Service Project(SoapUIWSDLBindingMockService)
and Select the option “Add Endpoint to
Interface”
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)
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.
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. |