agile web service and rest service testing with soapui
TRANSCRIPT
![Page 1: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/1.jpg)
Agile Web Service and REST Service Testing with soapUI
Robert D. Schneider
Principal
Think88 Ventures, LLC
www.think88.com/soapui
![Page 2: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/2.jpg)
Agenda
ďż˝ Introduction
ďż˝ Challenges of Agile Development and Web/REST
Service Testing
ďż˝ Using soapUI to Address these Challenges
ďż˝ Service Virtualization Scenarios
![Page 3: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/3.jpg)
About Think88
ďż˝ SOA-focused consultancy
• Silicon Valley-based
• Global alliances
ďż˝ Key practices
• Architecture, design, testing
• Training
ďż˝ Hands-on soapUI Pro Bootcamp (3 days)
• Offered in US, UK, Norway, Sweden, France, Poland, Denmark
ďż˝ Coming in Q4 2009: Advanced soapUI Pro
ďż˝ SOA workshops & certifications
• Governance
ďż˝ SOA governance assessment
ďż˝ Independent governance vendor selection
![Page 4: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/4.jpg)
About Eviware
ďż˝ soapUI released open-source in 2005
ďż˝ eviware software ab (Stockholm, Sweden) founded 2006
• Ole Matzura, CTO > 10 years experience
• Niclas Reimertz, CSO > 10 years experience
ďż˝ Commercial soapUI Pro release 2007
• More than 400,000 downloads
• Plugins for Eclipse, NetBeans, Intellij IDEA, maven
ďż˝ soapUI Pro > 1,000 licensees
• All sectors, Telecom predominant
![Page 5: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/5.jpg)
Challenges of Agile Development and
Web/REST Service Testing
![Page 6: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/6.jpg)
Agile Development & Web/REST Service Testing
� “Test first, early and often” is a key principle in agile development
� “Contract-first” design is a key underpinning of good SOA
practices
ďż˝ Unfortunately, there are several major problems in testing these
kinds of services
• WSDL complex to understand
• WADL not widely adopted
• Development delays
• QA not equipped to write code for tests
• Determining coverage
• Governance & refactoring
![Page 7: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/7.jpg)
Functional Testing
ďż˝ soapUI is designed to automate functional testing of
Web services
ďż˝ Functional testing is typically used in the following
situations:
• Unit testing
• Data driven testing
• Compliance testing
• Process testing
![Page 8: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/8.jpg)
Load Testing
ďż˝ Four primary styles of load testing:
• Functional
• Behavioral
• Performance
• Requirements-driven
ďż˝ Multiple types of load test can be part of one TestCase
• Lets you measure their effect on each other
![Page 9: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/9.jpg)
Using soapUI to Address these Challenges
![Page 10: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/10.jpg)
soapUI Test Structure & Terminology
ďż˝ Workspaces
• A grouping of projects
• Similar in concept to tools such as Eclipse
ďż˝ Projects
• These are the primary container of soapUI objects. Made up of:
ďż˝ Interfaces (based on the SOAP/HTTP binding for the PortType)
ďż˝ Test Suites
ďż˝ Mock Services
![Page 11: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/11.jpg)
soapUI Test Structure & Terminology
� TestSuites• These contain one or more TestCases
� TestCases• Serves as a container for one or more TestSteps
• Also contains TestRequests� Enables applying assertions to a response for a message
• SOAP• Schema validation• SOAP fault
� TestSteps• Individual Web service operation invocations
![Page 12: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/12.jpg)
TestSteps
ďż˝ Test Request
ďż˝ Groovy script
ďż˝ Properties
ďż˝ Property Transfer
ďż˝ Conditional Goto
ďż˝ Delay
ďż˝ Run TestCase
ďż˝ REST Test Request
ďż˝ HTTP Test Request
ďż˝ Mock Response
ďż˝ DataSource
ďż˝ DataSource Loop
ďż˝ DataSink
ďż˝ DataGen
![Page 13: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/13.jpg)
soapUI Test Structure & Terminology
ďż˝ DataSource
• Specialized type of TestStep, meant to streamline data-driven testing
ďż˝ JDBC
ďż˝ Excel
ďż˝ Grid
ďż˝ XML
ďż˝ File
ďż˝ Directory
ďż˝ Groovy
![Page 14: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/14.jpg)
soapUI Test Structure & Terminology
� Coverage• Metrics that indicate the degree to your tests cover your WSDL
• By functional test
• By MockService
• By Mock clients
• By SOAP monitor clients
� LoadTest• Utility for configuring, running, and monitoring load tests on a Web service
• Multiple scenarios can be set
• Also implements functional validation
• Load tests can be run in parallel
![Page 15: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/15.jpg)
soapUI and Scripting
� Employs the Groovy programming language• Version 3.0 will also support JavaScript
ďż˝ Designed to give tester maximal control and flexibility
� Can be used:• When opening/closing a project
• Within a test suite or test case
• When launching/halting a mock service
• To generate dynamic mock service responses
• To test assertions
• To add functionality to the soapUI product
![Page 16: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/16.jpg)
Groovy Fundamentals
ďż˝ An open scripting language
• Supports object-oriented and script-style programming
• Supports GUI development
• Integrates effortlessly with Java libraries
• Dynamic scripting for soapUI
ďż˝ soapUI provides Object Library and Event Model
groovy.codehaus.org
![Page 17: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/17.jpg)
What Can I Do From A Groovy Script?
ďż˝ Virtually anything
• Build entire TestCases (TestSteps, assertions, etc)
• Example: Store all requests, assertions in a database and have a
groovy-script that builds the TestCase and runs it dynamically
ďż˝ Create/manage/run MockServices
ďż˝ Create/open other projects
![Page 18: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/18.jpg)
Where Can Groovy Scripts Run?
� In addition to Groovy Script Step, any extension points:• TestCase Setup/TearDown scripts
• TestSuite Setup/TearDown scripts
• Project afterLoad/beforeSave scripts
• MockService onStart/onStop scripts
• MockOperation dispatch scripts
• MockResponse/MockResponseStep scripts
• Groovy DataSource/DataSink
• Script Assertions for TestRequestSteps and MockResponseSteps
![Page 19: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/19.jpg)
soapUI Architecture
ďż˝ WSDL-driven code generation for client and server-side
artifacts:
![Page 20: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/20.jpg)
Measuring Coverage
ďż˝ When testing a piece of software, we want to know
what percentage of its code has been “exercised”
ďż˝ A similar concept exists for distributed computing
technologies such as Web services
![Page 21: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/21.jpg)
Measuring Coverage
ďż˝ Three types of coverage scenario
• Functional tests
• Mock services
• SOAP monitoring
ďż˝ Two classes of coverage
• WSDL coverage
ďż˝ How much of a contract has been invoked?
• Assertion coverage
ďż˝ How many XPath assertions have been applied?
![Page 22: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/22.jpg)
Measuring Coverage
ďż˝ Coverage statistics aggregated at the following levels:
• Project
• TestSuite
• TestCase
ďż˝ Two coverage measurement options:
• Count empty responses as covered
• Count ? responses as covered
![Page 23: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/23.jpg)
Measuring Coverage
![Page 24: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/24.jpg)
Mock Services
� Sometimes, you just can’t connect to a Web service to test it• The service hasn’t been written yet, and/or
• The service has bugs but you need to keep building tests, and/or
• You’re on an airplane
� soapUI Mock Services let you build robust tests that utilized the contract• Supports agile development practices
ďż˝ These services are then run inside the included Jetty engine
![Page 25: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/25.jpg)
Mock Services and Responses
ďż˝ One of the beauties of mock services is that responses are completely configurable
ďż˝ You can define many different responses for a given operation
� Once responses are defined, you can then route incoming requests in a variety of ways:• Script
• Sequence
• Query match
• XPath
• Random
![Page 26: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/26.jpg)
Differences between soapUI and soapUI Pro
ďż˝ XML table inspection
ďż˝ Form editor
ďż˝ SOAP monitoring
ďż˝ WSDL coverage
ďż˝ Test refactoring
ďż˝ Drag-and-drop
ďż˝ Data source-driven tests
ďż˝ Data collection
ďż˝ Request/response coverage
ďż˝ Team-based projects
ďż˝ Script libraries
ďż˝ Scripting libraries
ďż˝ Code-free test assertions
![Page 27: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/27.jpg)
Service Virtualization Scenarios
![Page 28: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/28.jpg)
Virtualization Scenarios
ďż˝ #1 WSDL defined, but service not yet written
ďż˝ #2 Service written, but logic not fully implemented
ďż˝ #3 Need to feed data to a virtual service
ďż˝ #4 Need to feed large quantities of real data to a virtual
service
ďż˝ #5 Need to combine virtual service with a real service
![Page 29: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/29.jpg)
“WSDL defined, but service isn’t yet written”
Discussion
Demonstration
![Page 30: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/30.jpg)
![Page 31: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/31.jpg)
“Service written, but logic not fully implemented”
Discussion
Demonstration
![Page 32: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/32.jpg)
![Page 33: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/33.jpg)
“Need to feed data to a virtual service”
Discussion
Demonstration
![Page 34: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/34.jpg)
![Page 35: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/35.jpg)
“Need to feed large quantities of data to a virtual service”
Discussion
Demonstration
![Page 36: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/36.jpg)
![Page 37: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/37.jpg)
“Need to combine a virtual service with a live service”
Discussion
Demonstration
![Page 38: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/38.jpg)
![Page 39: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/39.jpg)
Questions
![Page 40: Agile Web Service and REST Service Testing with soapUI](https://reader036.vdocuments.us/reader036/viewer/2022071601/613d4fb5736caf36b75bd32e/html5/thumbnails/40.jpg)
Agile Web Service and REST Service Testing with soapUI
Robert D. Schneider
Principal
Think88 Ventures, LLC
www.think88.com/soapui