20
© 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

SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

  • Upload
    lenhu

  • View
    219

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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

Page 2: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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"

Page 3: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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:

Page 4: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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:

Page 5: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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:

Page 6: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 2012 IBM Corporation

Creating your First TestCase

■ Step 9: Enter the name for your TestSuite

■ Step 10: Enter the name for your TestCase

Page 7: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 2012 IBM Corporation

Creating your First TestCase

■ Step 11: Add the Request to TestCase and click ok

Page 8: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 2012 IBM Corporation

Submit your Request

■ Step 12: Click on the Submit Button highlighted to Submit your Request to specified endpoint URL

Page 9: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 2012 IBM Corporation

Submit your Request

■ Step 13: Select and copy the response SOAP message

Page 10: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 2012 IBM Corporation

Creating a new Assert test

■ Step 14: Click on the Add an assertion Button highlighted bellow

Page 11: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 2012 IBM Corporation

Creating a new Assert test

■ Step 15: Select the Source Property and the assertion and click Button Add as highlighted bellow

Page 12: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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:

Page 13: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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

Page 14: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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

Page 15: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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

Page 16: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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

Page 17: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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;

Page 18: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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

Page 19: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 2012 IBM Corporation

Test case Completed

■ Step 23: Now your test case is completed, tested and the Assertions are all green and valid.

Page 20: SoapUI 4.5.1 - Step by Step Tutorial to Create a ... · PDF fileStep 3: Double click on the soapUI application to open it and then select File --> New soap UI Project. Fill in the

© 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.