SoapUI Training
Induction course
Fresh Grads
Ionut David
02.04.2013
•What is SoapUI
•SoapUI Features
•SOAP and WSDL
•Functional Testing
•Service Mocking
Agenda
2
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.
SoapUI Features
4
• Functional Testing.
• Service Simulation.
• Security Testing.
• Load Testing.
• Technology Support.
• Automation.
• Analytics.
• Recording.
• Ecosystem.
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.
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
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
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
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
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
Functional Testing
11
• Create a SoapUI Project
• Right click on the project node and select New SoapUI Project.
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.
Functional Testing
13
• The Add WSDL dialog is now open
• Enter http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL.
• Click OK.
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
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)
Functional Testing
16
• Run a request to the Web Service
• Click on the green arrow head sign to submit the request.
Functional Testing
17
• Receive response
• On the right side of the window the response will be displayed.
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.
Functional Testing
19
• Create a Test Case from a request.
• In the request editor, select Add This Request to TestCase.
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.
Functional Testing
21
• Next step:
• The dialog box Add Request to TestCase will appear. Click OK.
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.
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
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.
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.
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.
Functional Testing
27
• Validate response with XPath Match:
• Select XPath Match from the Add Assertion menu.
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
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.
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?
Service Mocking
31
• Start a new SoapUI project using the following wsdl:
http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
• Click OK button.
Service Mocking
32
• Right-click on one of the SOAP interfaces and select Generate MockService.
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
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.
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
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
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.
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.
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.
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
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
Ionut David| Software Engineer
ionut.david@endava.com
Tel +40 727 772 636 |Skype en_idavid
thank you

More Related Content

PPTX
SonarQube Presentation.pptx
PPTX
Testing soapui
PPTX
Web Services and Introduction of SOAPUI
PPT
Ppt of soap ui
PPT
Selenium Automation Framework
PPTX
Responsive web designing
PPT
Automation testing
SonarQube Presentation.pptx
Testing soapui
Web Services and Introduction of SOAPUI
Ppt of soap ui
Selenium Automation Framework
Responsive web designing
Automation testing

What's hot (20)

PPTX
Rest assured
PPTX
TestNG Framework
PDF
Behavior Driven Development and Automation Testing Using Cucumber
PPTX
Selenium PPT 2.pptx
PDF
Web Services Automated Testing via SoapUI Tool
PPTX
GUI Testing
PPT
Maven Introduction
PDF
Introduction to burp suite
PDF
Cucumber ppt
ODP
Selenium ppt
PDF
Test Automation
PPT
QSpiders - Automation using Selenium
PPTX
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
PDF
Static Code Analysis
PPT
Performance Testing
PPT
Selenium Presentation at Engineering Colleges
PPTX
API Automation Testing Using RestAssured+Cucumber
PPTX
SonarQube - The leading platform for Continuous Code Quality
PDF
Accessibility Testing using Axe
PPT
Selenium Concepts
Rest assured
TestNG Framework
Behavior Driven Development and Automation Testing Using Cucumber
Selenium PPT 2.pptx
Web Services Automated Testing via SoapUI Tool
GUI Testing
Maven Introduction
Introduction to burp suite
Cucumber ppt
Selenium ppt
Test Automation
QSpiders - Automation using Selenium
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Static Code Analysis
Performance Testing
Selenium Presentation at Engineering Colleges
API Automation Testing Using RestAssured+Cucumber
SonarQube - The leading platform for Continuous Code Quality
Accessibility Testing using Axe
Selenium Concepts
Ad

Viewers also liked (15)

PPTX
Testing web services
PDF
API Testing: The heart of functional testing" with Bj Rollison
PPTX
В поисках магической кнопки, или как воспитать SoapUI
PPTX
Автоматизация настолько хороша, насколько хорош человек использующий ее (блиц...
PDF
Automate REST API Testing
PPT
SOAP-UI The Web service Testing
PPTX
An introduction to api testing | David Tzemach
PPTX
REST API testing with SpecFlow
PPT
Presentation for soap ui
PPT
Soa testing soap ui (2)
PPTX
Getting Started with API Security Testing
PPTX
Testing Agile Web Services from soapUI
PDF
API Testing
PDF
4 Major Advantages of API Testing
PPTX
Api testing
Testing web services
API Testing: The heart of functional testing" with Bj Rollison
В поисках магической кнопки, или как воспитать SoapUI
Автоматизация настолько хороша, насколько хорош человек использующий ее (блиц...
Automate REST API Testing
SOAP-UI The Web service Testing
An introduction to api testing | David Tzemach
REST API testing with SpecFlow
Presentation for soap ui
Soa testing soap ui (2)
Getting Started with API Security Testing
Testing Agile Web Services from soapUI
API Testing
4 Major Advantages of API Testing
Api testing
Ad

Similar to Learn SoapUI (20)

PPTX
Web services testing
PPTX
WebServices using Soap
PPTX
SoapUi using WebServices
PPTX
WebServices using Soapui
PPTX
Testing soapui
 
PPTX
SOAPUI Test Design & Utilities
PDF
Soapui tutorial
PPT
Introduction to soapui and webservices
DOC
Soap ui documentation
PPTX
API-Testing-SOAPUI-1.pptx
PDF
Webservices Testing PPT.pdf
PPTX
Introduction to SoapUI day 4-5
PPTX
SOA Testing
PPTX
Soap UI - Getting started
PPTX
Introduction to SoapUI day 1
PDF
Soap ui and soapui pro course contents
PDF
Webservices(or)SoapUI Interview Questions
PDF
API Testing. Streamline your testing process.
PPTX
Soap UI and postman
PPTX
Soap UI - Lesson45
Web services testing
WebServices using Soap
SoapUi using WebServices
WebServices using Soapui
Testing soapui
 
SOAPUI Test Design & Utilities
Soapui tutorial
Introduction to soapui and webservices
Soap ui documentation
API-Testing-SOAPUI-1.pptx
Webservices Testing PPT.pdf
Introduction to SoapUI day 4-5
SOA Testing
Soap UI - Getting started
Introduction to SoapUI day 1
Soap ui and soapui pro course contents
Webservices(or)SoapUI Interview Questions
API Testing. Streamline your testing process.
Soap UI and postman
Soap UI - Lesson45

Recently uploaded (20)

PDF
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
PPTX
Strategic Picks — Prioritising the Right Agentic Use Cases [2/6]
PDF
Examining Bias in AI Generated News Content.pdf
PDF
Addressing the challenges of harmonizing law and artificial intelligence tech...
PDF
The Digital Engine Room: Unlocking APAC’s Economic and Digital Potential thro...
PDF
TicketRoot: Event Tech Solutions Deck 2025
PDF
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
PDF
Fitaura: AI & Machine Learning Powered Fitness Tracker
PDF
Intravenous drug administration application for pediatric patients via augmen...
PDF
Advancements in abstractive text summarization: a deep learning approach
PDF
Domain-specific knowledge and context in large language models: challenges, c...
PPT
Overviiew on Intellectual property right
PDF
Human Computer Interaction Miterm Lesson
PDF
Child-friendly e-learning for artificial intelligence education in Indonesia:...
PPTX
From Curiosity to ROI — Cost-Benefit Analysis of Agentic Automation [3/6]
PDF
Uncertainty-aware contextual multi-armed bandits for recommendations in e-com...
PDF
substrate PowerPoint Presentation basic one
PPTX
Report in SIP_Distance_Learning_Technology_Impact.pptx
PDF
Decision Optimization - From Theory to Practice
PDF
Applying Agentic AI in Enterprise Automation
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
Strategic Picks — Prioritising the Right Agentic Use Cases [2/6]
Examining Bias in AI Generated News Content.pdf
Addressing the challenges of harmonizing law and artificial intelligence tech...
The Digital Engine Room: Unlocking APAC’s Economic and Digital Potential thro...
TicketRoot: Event Tech Solutions Deck 2025
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
Fitaura: AI & Machine Learning Powered Fitness Tracker
Intravenous drug administration application for pediatric patients via augmen...
Advancements in abstractive text summarization: a deep learning approach
Domain-specific knowledge and context in large language models: challenges, c...
Overviiew on Intellectual property right
Human Computer Interaction Miterm Lesson
Child-friendly e-learning for artificial intelligence education in Indonesia:...
From Curiosity to ROI — Cost-Benefit Analysis of Agentic Automation [3/6]
Uncertainty-aware contextual multi-armed bandits for recommendations in e-com...
substrate PowerPoint Presentation basic one
Report in SIP_Distance_Learning_Technology_Impact.pptx
Decision Optimization - From Theory to Practice
Applying Agentic AI in Enterprise Automation

Learn SoapUI

  • 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 [email protected] Tel +40 727 772 636 |Skype en_idavid thank you