Академический Документы
Профессиональный Документы
Культура Документы
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
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"
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:
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:
Step 8: Click on the Add this Request to a TestCase Button as highlighted on the picture bellow:
Step 12: Click on the Submit Button highlighted to Submit your Request to specified endpoint URL
Step 15: Select the Source Property and the assertion and click Button Add as highlighted bellow
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:
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
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
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
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
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;
Step 23:Click on the Submit Button highlighted to Submit your Request to endpoint URL and validate the our assertions
Step 23: Now your test case is completed, tested and the Assertions are all green and valid.
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.