Your SlideShare is downloading. ×
0
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Learn SoapUI
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Learn SoapUI

7,063

Published on

Lear how to use SoapUI

Lear how to use SoapUI

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,063
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
432
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. SoapUI Training Induction course Fresh Grads Ionut David 02.04.2013
  • 2. •What is SoapUI •SoapUI Features •SOAP and WSDL •Functional Testing •Service Mocking Agenda 2
  • 3. What is SoapUI 3 • Free and open source cross-platform Functional Testing solution. • Creating even the most advanced test scenarios is very simple. • SoapUI is a complete and automated testing solution. • Testing for everyone. • Streamlined service simulation. • Advanced functionality comes standard.
  • 4. SoapUI Features 4 • Functional Testing. • Service Simulation. • Security Testing. • Load Testing. • Technology Support. • Automation. • Analytics. • Recording. • Ecosystem.
  • 5. What is a Web Service 5 • A web service is a method of communication between two electronic devices over the World Wide Web. A web service is a software function provided at a network address over the web or the cloud, it is a service that is "always on“. • The Web Services Description Language is an XML-based interface description language that is used for describing the functionality offered by a web service. A WSDL description of a web service (also referred to as a WSDL file) provides a machine-readable description of how the service can be called, what parameters it expects, and what data structures it returns.
  • 6. SOAP and WSDL 6 • XML-based protocol to let applications exchange information over HTTP. • SOAP stands for Simple Object Access Protocol • SOAP is a communication protocol • SOAP is a format for sending messages • SOAP is platform independent • SOAP is language independent • XML-based language for describing Web services and how to access them. • WSDL stands for Web Services Description Language • WSDL is an XML document • WSDL is also used to locate Web services. SOAP Definition WSDL Definition
  • 7. SOAP and WSDL 7 • A SOAP message is an ordinary XML document containing the following elements: • An Envelope element that identifies the XML document as a SOAP message. • A Header element that contains header information. • A Body element that contains call and response information. • A Fault element containing errors and status information. SOAP Syntax
  • 8. SOAP and WSDL 8 <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Header> ... </soap:Header> <soap:Body> ... <soap:Fault> ... </soap:Fault> </soap:Body> </soap:Envelope> SOAP Syntax Example
  • 9. SOAP and WSDL 9 • A WSDL document describes a web service using these major elements: • A container for data type definitions used by the web service. • A typed definition of the data being communicated. • A set of operations supported by one or more endpoints. • A protocol and data format specification for a particular port type. WSDL Document Structure
  • 10. SOAP and WSDL 10 <definitions> <types> data type definitions........ </types> <message> definition of the data being communicated.... </message> <portType> set of operations...... </portType> <binding> protocol and data format specification.... </binding> </definitions> WSDL Example
  • 11. Functional Testing 11 • Create a SoapUI Project • Right click on the project node and select New SoapUI Project.
  • 12. Functional Testing 12 • In the New SoapUI Project dialog enter a project name (i.e. Country_info) and click OK. • Right click on the project node and select Add WSDL.
  • 13. Functional Testing 13 • The Add WSDL dialog is now open • Enter http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL. • Click OK.
  • 14. Functional Testing 14 • Now see that the WSDL was successfully added to the project by seeing the operations in the Web Service in the navigatorEnter
  • 15. Functional Testing 15 • Create a request from your WSDL • Click on the plus sign next to the web service in the navigator to expand. • Double click on the request. • You now have to enter your data manually in the code editor as shown below. Replace “?” with “RO” (without quotes)
  • 16. Functional Testing 16 • Run a request to the Web Service • Click on the green arrow head sign to submit the request.
  • 17. Functional Testing 17 • Receive response • On the right side of the window the response will be displayed.
  • 18. Functional Testing 18 • Run an invalid request to the Web Service. • Introduce a wrong country code (like “ZZ”). • Click on the green arrow head sign to submit the request. • The response of the Web Service will indicate that the country was not found. • After seeing the result, correct the input data.
  • 19. Functional Testing 19 • Create a Test Case from a request. • In the request editor, select Add This Request to TestCase.
  • 20. Functional Testing 20 • Next step: • Adding a request to a TestCase will open the Create TestSuite dialog box. Enter a name for your TestSuite and click OK. • After clicking OK, you will be asked to create a TestCase. In the Create TestCase dialog, enter a name for your TestCase and click OK.
  • 21. Functional Testing 21 • Next step: • The dialog box Add Request to TestCase will appear. Click OK.
  • 22. Functional Testing 22 • Final step: • SoapUI will now generate a TestSuite and TestCase for you while the request will be added as a TestRequest. Below is a copy of the request that appears in the interface. A TestCase editor will also open with your new TestRequest. • The next step is to validate the response in your test by adding an Assertion.
  • 23. Functional Testing 23 • Add an Assertion to the test: • Now that we've created and run our first test, we are going to add a validation of the response. In SoapUI, this is called adding an assertion. • Examples of assertions that is possible in SoapUI are: • Schema Compliance • Simple Contains • Simple Not Contains • SOAP Faults • Response SLA • XPath Match • XQuery Match • WS Security Status • WS-Addressing Request/Response Assertion • Script Assertion
  • 24. Functional Testing 24 • Close all windows you have open in SoapUI before starting: • Double Click on your Test Request as shown below. This will open the request editor. • After clicking OK, you will be asked to create a TestCase. In the Create TestCase dialog, enter a name for your TestCase and click OK.
  • 25. Functional Testing 25 • Next step: • Select Response SLA from the Add Assertion menu. • In the Configure Response SLA Assertion dialog box, write 500 and click OK. This will validate that the response of the SLA is under 500.
  • 26. Functional Testing 26 • Next step: • Now that you've added the assertion, you are going to run the request to validate the response. If all assertions are successful, the SOAP icon should turn green in three places as shown below.
  • 27. Functional Testing 27 • Validate response with XPath Match: • Select XPath Match from the Add Assertion menu.
  • 28. Functional Testing 28 • Validate response with XPath Match: • In the XPath Match Configuration press Declare button and write below “//m:CapitalCityResult” • Click “Select from current” and you should see the word Bucharest appearing in the Expected Results field. • Click Save
  • 29. Functional Testing 29 • Final step: • Now that you've added a new assertion, you are going to run the test again. If all assertions are successful, the SOAP icon should turn green in three places as shown below.
  • 30. Service Mocking 30 • “Service Mocking, or simulation, is the practice of creating a facsimile environment that works similar to the environment you’re facsimileing”. • When to use it: You should use mocks when you can’t use the real thing • Advantages: • You can create tests in advance. • Teams can work in parallel. • You can create proof of concepts or demos. • You can isolate systems. • You can write test for resource not accessible. • Mock can be delivered to the customer. • Disadvantages: • You have to do Double work. • Deployment constraints. • It’s not live is it?
  • 31. Service Mocking 31 • Start a new SoapUI project using the following wsdl: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL • Click OK button.
  • 32. Service Mocking 32 • Right-click on one of the SOAP interfaces and select Generate MockService.
  • 33. Service Mocking 33 • In the dialog Generate Mock Service you can specify the local port/path for the service you're creating but for the moment just click OK
  • 34. Service Mocking 34 • Enter the name of your Mock Service in the Name dialog and click OK. For example: Mock convertor • After creating the MockService, you should get a MockService with one operation and one request. • As you can see, the Icons are Grey and inactive. This is an indication that the MockService is not yet running. We have successfully created our first MockService.
  • 35. Service Mocking 35 • Now, double click on the MockService to see the MockService editor. In the editor we can see a list of all operations for the service, as well as a request and response log which logs all incoming requests that have been handled by the MockService. • Double Click on the Conversion Rate Operation to see the MockResponses we have in the MockService
  • 36. Service Mocking 36 • As you can see we do only have one, Let's edit it, double click on it to open the Response Editor • The MockResponse editor is very similar to the standard SoapUI Request editor , but instead of requests, we'll edit responses. The Incoming Request view is still very useful; it shows the last received request to the operation which is useful for debugging client calls, including attachments and HTTP headers. • Edit the ConversionRateResult to be something else than the default empty value "?“. For example: 2.5
  • 37. Service Mocking 37 • First we must start the MockService. Click the Start button in the MockService editor, the green arrow head , this will start the service on the configured port and path • To the Top Right of the Editor you should see that it's running, and the port it's responding on. The play Button is greyed out and if you would like to stop the MockService, just click the stop button.
  • 38. Service Mocking 38 • Now in the MockResponse editor, Click the Button Create Request. • This will prompt you to open one of the existing requests for its operation in your project. • You will also need to give it a name.
  • 39. Service Mocking 39 • When you open the request, SoapUI will automatically change its endpoint to the endpoint of the locally running MockService instead of the endpoint that the WSDL is using. Submit the opened request by clicking the Run Button • As you can see the MockService returned the values we entered earlier as the response.
  • 40. Service Mocking 40 • Let's continue by making the created MockResponse a bit more dynamic by changing the dispatch and by Groovy scripting. • First we’ll create a second MockResponse. • Give it a Groovy Name
  • 41. Service Mocking 41 • Let's write a script for the response. Click the Script tab in the Response and enter the following Groovy Script, (context.rand = Math.random() *10) It will look like this: • This script sets a property called rand to a random number (from 0 to 10). • Now that we have written a script and the random results will be inserted into the response.
  • 42. 42 Ionut David| Software Engineer ionut.david@endava.com Tel +40 727 772 636 |Skype en_idavid thank you

×