Upload
lenhu
View
219
Download
0
Embed Size (px)
Citation preview
© 2009 IBM Corporation
SoapUI 4.5.1 - Step by Step Tutorial to Create a WebServices Regression Test using XPath Match Assertions: (SOAP:Envelope, Body, Wildcards [Exists and Matches]) and RegEx.
Soap-UI 4.5.1
Thomas Modeneis
© 2012 IBM Corporation
How to - Creating the project and connecting to a Webservice WSDL.
■ Step 1: Download and install soapUI OpenSource version from http://www.soapui.org/.
■ Step 2: The URL for the WSDL file is --> http://www.webservicex.net/CurrencyConvertor.asmx?wsdl
■ Step 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the details as shown below and click "OK"
© 2012 IBM Corporation
Understanding the soapUI Navigator pane and the Request
■ Step 4: When you press the "OK" button, you should see the following folder structure on the soapUI Navigator pane:
■ Step 5: Double click on Request1, You will see the Submit Button, The WebService URL and the divided window. One for the request and the other for the response:
© 2012 IBM Corporation
Submiting a Request
■ Step 6: Change the argument FromCurrency to GBP and ToCurrency to USD.
■ Step 7: Click on the Submit Button highlighted above and you will get the response back as shown below:
© 2012 IBM Corporation
Creating your First TestCase
■ Step 8: Click on the Add this Request to a TestCase Button as highlighted on the picture bellow:
© 2012 IBM Corporation
Creating your First TestCase
■ Step 9: Enter the name for your TestSuite
■ Step 10: Enter the name for your TestCase
© 2012 IBM Corporation
Creating your First TestCase
■ Step 11: Add the Request to TestCase and click ok
© 2012 IBM Corporation
Submit your Request
■ Step 12: Click on the Submit Button highlighted to Submit your Request to specified endpoint URL
© 2012 IBM Corporation
Submit your Request
■ Step 13: Select and copy the response SOAP message
© 2012 IBM Corporation
Creating a new Assert test
■ Step 14: Click on the Add an assertion Button highlighted bellow
© 2012 IBM Corporation
Creating a new Assert test
■ Step 15: Select the Source Property and the assertion and click Button Add as highlighted bellow
© 2012 IBM Corporation
Specify the XPath expression and expected result
■ The dialog is divided into two areas; the top specifies the XPath expression to apply, and the bottom the Expected Result. Next step is to specify the XPath expression
■ Step 16: Paste the SOAP response message from the Step 13 on the Expected Result as highlighted bellow:
© 2012 IBM Corporation
Specify the XPath expression and expected result■ Step 17: Now its time to create the XPath Expression, we have selected the "Allow Wildcards" option
and replaced the ConversionRateResult value with a '*' which will result in soapUI ignoring the value when asserting the result.
■ Step 18: Click Save
© 2012 IBM Corporation
Specify the XPath expression and expected result■ Step 19: Now its time to declare an XPath expression to validate the soap:Body Exists inside the
SOAP message, so create a new Assert XPath following again the steps 14,15 and 16
© 2012 IBM Corporation
Specify the XPath expression and expected result■ Step 20: Now its time to declare an XPath expression to validate the soap:ConversionRateResponse
Exists inside the SOAP message, so create a new Assert XPath following again the steps 14,15 and 16
© 2012 IBM Corporation
Specify the XPath expression and expected result■ Step 21: Now its time to declare an XPath expression to validate the soap:ConversionRateResult
Exists inside the SOAP message, so create a new Assert XPath following again the steps 14,15 and 16
© 2012 IBM Corporation
Specify the XPath expression and expected result■ Step 22: Now its time to declare an XPath expression to validate the soap:ConversionRateResult text
matches with a regular number inside the SOAP message, so create a new Assert XPath following again the steps 14,15 and 16.
■ The Declaration bellow is a RegEx expression, a regular expression should be used ('.\d') to validate the selected node;
© 2012 IBM Corporation
Running the Test Assertions
■ Step 23:Click on the Submit Button highlighted to Submit your Request to endpoint URL and validate the our assertions
© 2012 IBM Corporation
Test case Completed
■ Step 23: Now your test case is completed, tested and the Assertions are all green and valid.
■
© 2012 IBM Corporation
Summary
■Summary■ SoapUI provides a robust set of capabilities to test web services not only during development, but also
to test the validity of deployments.
■ We were able to test the functionality of our web services during development, and also create a simple regression test. With it we are able to deploy and validate new versions of our service in a manner of minutes. This was a great time saver and allowed us to confidently declare our web services as available to consumers.
■ I hope this Tutorial would be of some help for you to understand the “Assertion in soapUI OpenSource Version”.
■Thank You.