Sunteți pe pagina 1din 13

How to test WebMethods webService using

SoapUI
09/12/2009

WebMethods Developer

Ankit Malhotra
ankit1.m@tcs.com

TCS Public
Confidentiality Statement

This asset is confidential to Tata Consultancy Services Ltd and shall not be distributed
outside TCS.

Strictly to be used only for TCS internal training and knowledge sharing purposes.

TCS Public
Abstract
The pre-requisite before delivering the code for user acceptance testing is unit testing of the
code. In present day scenario, unit testing not only means testing the services developed and
validating the connectivity to the target application but testing it end to end before delivering
it to the user for further validation.

There are several testing tools available in the market for testing the webMethods code. Tools
which I have used are JMeter and soapUI.

TCS Public
WebService Testing
I am presenting a very basic idea of testing a webService call using the tool soapUI in this
article. This can be extended to the highest complexity as per the developer and project
requirement.
This tool also helps us doing the validation of the code to a very basic level after moving the
webmethods package/code from one server to other servers.

TCS Public
WebMethods Descriptor
We are going to test a very basic webMethods flow service which I will expose as a webService
for testing purpose.
I have built a flow service “addInt”, this service call WmPublic service “pub.math: addInts”.
Attached is the screen shot (Fig: 1) of the signature of this service.
This service I want to expose as a webService to any consumers. So I created a webService
descriptor as provider (Fig: 2) for the service addInt.

TCS Public
SoupUI Project
Below steps is used to create a SoapUI project for calling webMethods descriptor.

We are going to do the following:

• Set up a test project


• Add a WSDl that defines the Web Service
• Make some Requests

1. Create a New SoapUI Project from File Menu.


2. Provide the Project Name and the mention the WSDL URL.
3. Select the appropriate check button (Fig: 3) to Create Request, Create Test Suite or
Create Mock Service.
4. Provide appropriate request properties (Fig: 4). Mention Username and password.
5. Right click on Request and select Show Request Editor. You will see the request
editor with input fields having null or “?”.
6. Enter appropriate inputs and execute the service. You will get a response as error
or success in the editor (Fig: 5).

Create Test Suite:

This section introduces the simple and powerful load testing functionality allowing you to:
• Validate a Web Services performance under different Load scenarios
• Maintain Functional validations to see that they don't "break" under load
• Run several load tests simultaneously to see how they affect each other

1. Right click on the project and select “Generate TestSuite”.


2. Select appropriate inputs while generating the TestSuite (Fig: 6)
3. Open the Test Case in an editor and modify the input as required (Fig: 7).
4. Test the test case for error or success response.

TCS Public
5. For load test, open the load test case editor, by double clicking on the
editor.
6. Adjust the Threads, Strategy, Test Delay and many more.
7. Start the test through run button in the editor window (Fig: 8).
8. You can obtain the appropriate graph for thread and time consumed per
request (ms).
9. The output gives you a statistics max, min and average time consumed
(Fig: 8).

Create Mock Service:


1. Create soapUI TestSuites and TestCases against MockServices before or
during the actual services being implemented.
2. This service will generate a response from the WSDL signature, which
can be used to test the request under SoapUI.

TCS Public
Conclusion

The test tool “SoapUI” is very handy to test the webService which are developed in
webMethods or any other language. The only requirement is the WSDL for the service to be
tested.
The tool provides a very accurate result for analysis and also provides the statistical view of the
testing.
I would suggest using this tool after the development phase and if the project requires, this
tool can be used for Functional testing.

TCS Public
Fig: 1

Fig: 2

TCS Public
Fig: 3

Fig: 4

TCS Public
Fig: 5

Fig: 6

TCS Public
Fig: 7

Fig: 8

TCS Public
Reference:

http://www.wmusers.com
http://www.soapui.org/

TCS Public

S-ar putea să vă placă și