testing web services
TIME TO REST
Who am I
Iurii Kutelmakh
email: iurii.kutelmakh@gmail.com
skype: ykutelmakh
linkedIn: linkedin.com/in/ykutelmakh
Senior QA Engineer
@ DataArt
Director, lecturer
@ Lviv IT School
DJ
@ Sunday Sofa Podcast
AGENDA
web services
SOAP vs RESTful
web services testing: from manual to automation
web services
Web services are open standard
(XML, SOAP, HTTP etc.) based web applications
that interact with other web applications for
the purpose of exchanging data
web services characteristics:
- document based (xml / json)
- cross platform
- widely available (http / ftp)
- synchronous / asynchronous
Standart SOAP service components:
•SOAP (Simple Object Access Protocol)
•UDDI (Universal Description, Discovery and Integration)
•WSDL (Web Services Description Language)
soap request soap response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Date: Wed, 14 Jan 2015 15:33:32 GMT
Pragma: no-cache
Content-Length: 122
Content-Type: application/xml
Accept: application/xml
. . .
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
...>
<SOAP-ENV:Body>
<method:GetCustomerInfoResponse>
<name>Test Name</name>
<phone>+380000000000</phone>
<street1>Hutorivka 35</street1>
<street2></street2>
<city>Lviv</city>
<state></state>
<postalcode>79000</postalcode>
<country>Ukraine</country>
<method:OutputParam>Value</method:OutputParam>
</method:GetCustomerInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
POST http://{url}?parameter=value HTTP/1.1
Host: HostServerName
Content-type: text/xml; charset=utf-8
Content-length: 350
SoapAction: http://tempUri.org/GetCustomerInfo
...
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetCustomerInfo xmlns="http://tempUri.org/">
<CustomerID>18102016</CustomerID>
<OutputParam />
</GetCustomerInfo>
</soap:Body>
</soap:Envelope>
REST (Representational State Transfer)
permedia systems, describing the software engineering principles guiding REST and the interaction constrain
while contrasting them to the constraints of other architectural styles.
stateful vs stateless
stateful means that there is memory of the past.
Previous transactions are remembered and may affect the current transaction.
stateless means there is no memory of the past.
Every transaction is performed as if it were being done for the very first time.
The Representational State Transfer (REST) style
is an abstraction of the architectural elements within a distributed hypermedia
system.
The key abstraction of information in REST is a resource
1. Uniform Interface
Individual resources are identified using URLs.
2. Stateless Interactions
None of the clients context is to be stored on the server side between the request.
3. Cacheable
Clients can cache the responses.
4. Client-Server
The clients and the server are separated from each other.
5. Layered System
At any time client cannot tell if it is connected to the end server or to an intermediate.
6. Code on Demand
An optional constraint where the server temporarily extends the functionality of a client by the transfer of
executable code.
HATEOAS stands for Hypertext As The Engine Of Application State.
It means that hypertext should be used to find your way through the API.
GET /account/12345 HTTP/1.1
HTTP/1.1 200 OK
<?xml version="1.0"?>
<account>
<account_number>12345</account_number>
<balance currency="usd">100.00</balance>
<link rel="deposit" href="/account/12345/deposit" />
<link rel="withdraw" href="/account/12345/withdraw" />
<link rel="transfer" href="/account/12345/transfer" />
<link rel="close" href="/account/12345/close" />
</account>
web services testing
good to know …
In computer programming, an application programming interface (API) is a set of subroutine
definitions, protocols, and tools for building software and applications
In the simplest terms,
APIs are sets of requirements that govern how one application can talk to another
good to know …
request methods:
-GET
-POST
-PUT
-DELETE
-OPTIONS, TRACE, HEAD, PATCH
headers:
-Cookie
-Location
-Date
-Content-Type
-etc
status codes:
-100 (info)
-200 (success)
-300 (redirect)
-400 (client error)
-500 (server error)
testing technics:
-functional
-performance
-security
-static testing
Request:
- boundary values
- equivalence partitioning
Response:
- data type
- data structure
- data fullness
practice
tools:
- Postman
- SoapUI
- Automation framework (Java + TestNg + RestAssured)
thanks

Time to REST: testing web services

  • 1.
  • 2.
    Who am I IuriiKutelmakh email: iurii.kutelmakh@gmail.com skype: ykutelmakh linkedIn: linkedin.com/in/ykutelmakh Senior QA Engineer @ DataArt Director, lecturer @ Lviv IT School DJ @ Sunday Sofa Podcast
  • 3.
    AGENDA web services SOAP vsRESTful web services testing: from manual to automation
  • 4.
  • 6.
    Web services areopen standard (XML, SOAP, HTTP etc.) based web applications that interact with other web applications for the purpose of exchanging data
  • 7.
    web services characteristics: -document based (xml / json) - cross platform - widely available (http / ftp) - synchronous / asynchronous
  • 10.
    Standart SOAP servicecomponents: •SOAP (Simple Object Access Protocol) •UDDI (Universal Description, Discovery and Integration) •WSDL (Web Services Description Language)
  • 13.
    soap request soapresponse HTTP/1.1 200 OK Cache-Control: no-cache, no-store, max-age=0, must-revalidate Date: Wed, 14 Jan 2015 15:33:32 GMT Pragma: no-cache Content-Length: 122 Content-Type: application/xml Accept: application/xml . . . <?xml version="1.0" encoding="utf-8" ?> <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" ...> <SOAP-ENV:Body> <method:GetCustomerInfoResponse> <name>Test Name</name> <phone>+380000000000</phone> <street1>Hutorivka 35</street1> <street2></street2> <city>Lviv</city> <state></state> <postalcode>79000</postalcode> <country>Ukraine</country> <method:OutputParam>Value</method:OutputParam> </method:GetCustomerInfoResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> POST http://{url}?parameter=value HTTP/1.1 Host: HostServerName Content-type: text/xml; charset=utf-8 Content-length: 350 SoapAction: http://tempUri.org/GetCustomerInfo ... <?xml version="1.0" encoding="utf-8" ?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetCustomerInfo xmlns="http://tempUri.org/"> <CustomerID>18102016</CustomerID> <OutputParam /> </GetCustomerInfo> </soap:Body> </soap:Envelope>
  • 15.
    REST (Representational StateTransfer) permedia systems, describing the software engineering principles guiding REST and the interaction constrain while contrasting them to the constraints of other architectural styles.
  • 16.
  • 17.
    stateful means thatthere is memory of the past. Previous transactions are remembered and may affect the current transaction. stateless means there is no memory of the past. Every transaction is performed as if it were being done for the very first time.
  • 18.
    The Representational StateTransfer (REST) style is an abstraction of the architectural elements within a distributed hypermedia system. The key abstraction of information in REST is a resource
  • 19.
    1. Uniform Interface Individualresources are identified using URLs. 2. Stateless Interactions None of the clients context is to be stored on the server side between the request. 3. Cacheable Clients can cache the responses. 4. Client-Server The clients and the server are separated from each other. 5. Layered System At any time client cannot tell if it is connected to the end server or to an intermediate. 6. Code on Demand An optional constraint where the server temporarily extends the functionality of a client by the transfer of executable code.
  • 20.
    HATEOAS stands forHypertext As The Engine Of Application State. It means that hypertext should be used to find your way through the API. GET /account/12345 HTTP/1.1 HTTP/1.1 200 OK <?xml version="1.0"?> <account> <account_number>12345</account_number> <balance currency="usd">100.00</balance> <link rel="deposit" href="/account/12345/deposit" /> <link rel="withdraw" href="/account/12345/withdraw" /> <link rel="transfer" href="/account/12345/transfer" /> <link rel="close" href="/account/12345/close" /> </account>
  • 21.
  • 22.
    good to know… In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building software and applications In the simplest terms, APIs are sets of requirements that govern how one application can talk to another
  • 23.
    good to know… request methods: -GET -POST -PUT -DELETE -OPTIONS, TRACE, HEAD, PATCH headers: -Cookie -Location -Date -Content-Type -etc status codes: -100 (info) -200 (success) -300 (redirect) -400 (client error) -500 (server error)
  • 24.
  • 25.
    Request: - boundary values -equivalence partitioning Response: - data type - data structure - data fullness
  • 26.
  • 27.
    tools: - Postman - SoapUI -Automation framework (Java + TestNg + RestAssured)
  • 29.