Upload
taras-lytvyn
View
8.202
Download
0
Embed Size (px)
DESCRIPTION
Testing web services is very important part of integration testing on web projects. In this presentation you can learn the best approaches, tools and features of Web Services testing. Soon I'll share url with a video from my presentation.
Citation preview
Testing web services
About Me
Prehistory
Service = web interface
+ Web service on Java
+DB usage
SERVICE AS STATE MACHINE
Google services
Web Services
What is web service ?QA point of view
Examples
You can find web services in Network tab
Classification
REST
SOAP
RESTRepresentational
State Transfer
1. Give every “thing” an ID2. Link things together3. Use standard methods4. Resources can have multiple representations5. Communicate independently
SOAP1. Use WSDL for description2. SOAP is approach of
protocols and standards3. Works with operationsSimple Object
Access Protocol
WSDL
Web Services Description Language is an XML-based
interface description language that is used for describing the functionality offered by a web
service.
Request methods
Content Type on response
So what to test ?
Response Correctness
data datatype
dataorder
fullness
What else ?
•client part that uses this service•http statuses•authorization• response timeout• load testing• security testing
•NEGATIVE cases !
REAL EXAMPLEGET http://maps.googleapis.com/maps/api/elevation/json?locations=39.7391536, -104.9847034|36.455556, -116.866667&sensor=true
Valid HTTP status code – 200 OK
Response timeout !>= 0.5 s
Negative cases (check status):- incorrect locations- incorrect sensor value
{ "results": [ { "elevation": 1608.637939453125, "location": { "lat": 39.7391536, "lng": -104.9847034 }, "resolution": 4.771975994110107 }, { "elevation": -50.78903579711914, "location": { "lat": 36.455556, "lng": -116.866667 }, "resolution": 19.08790397644043 } ], "status": "OK"}
<Response xmlns="http://maps.googleapis.com/maps/api/elevation/json"> <results> <e> <elevation>1608.637939453125</elevation> <location> <lat>39.7391536</lat> <lng>-104.9847034</lng> </location> <resolution>4.771975994110107</resolution> </e> <e> <elevation>-50.78903579711914</elevation> <location> <lat>36.455556</lat> <lng>-116.866667</lng> </location> <resolution>19.08790397644043</resolution> </e> </results> <status>OK</status></Response>
So how to test ?
Service MocksParsing
- xpaths- regexps
ManuallyAutomation !!!
TEST WITH:
Testing features...
PROBLEMS:
- SERVICE DOCUMENTATION- DBC - “DYNAMIC” RESPONSE PROBLEM
SERVICE DOCUMENTATION
DOC. example
DATA BASE Connectionfor reading data
“Dynamic” response
Tools
rem curl -i -H "Content-Type: application/json" -X POST -d "11032480" http://172.22.40.73:8080/gift-registry/registry-products/5017a4d3ee12d093a5794968/delete
EXAMPLE:
Manual testing
SOAP UI- Support different service standards- Service mocking- Groovy & Java API- Ability of Security and Load Service
Testing- Logging results- Maven plugin +- Could be easily integrated to CI- Eclipse Plugin- Test Suite could executed with JUnit
SOAP UI PROJECT SAMPLE
REAL EXAMPLEGET http://maps.googleapis.com/maps/api/elevation/json?locations=39.7391536, -104.9847034|36.455556, -116.866667&sensor=true
Valid HTTP status code – 200 OK
Response timeout !>= 0.5 s
Response correctness
SOAP UI TESTING VIDEO
CLICK TO WATCH VIDEO ON YOUTUBE
Response parsing
approach
JSON Object Library
JACKSON JSON LIBRARY
{ "results": [ { "elevation": 1608.637939453125, "location": { "lat": 39.7391536, "lng": -104.9847034 }, "resolution": 4.771975994110107 }, { "elevation": -50.78903579711914, "location": { "lat": 36.455556, "lng": -116.866667 }, "resolution": 19.08790397644043 } ], "status": "OK"}
fill levelsCorrect
Conclusion
SUCCESSFUL WEB SERVICE TESTING =
SOAP UI + ECLIPSE + JAVA + JACKSON + SOAP UI JAVA API
resolve all needs, approaches and
problems described earlier
Thank you !