14
Testing web services (SOAP) PIOTR BOHO SENIOR TEST AUTOMATION ENGINEER IN KAINOS 1

Piotr Boho - testing web services (soap)

Embed Size (px)

Citation preview

1

Testing web services (SOAP)PIOTR BOHO

SENIOR TEST AUTOMATION ENGINEER IN KAINOS

2

3

Agenda1. What is SOAP webservice – tester perspective

2. Manual testing approach

3. Pro / cons manual tests

4. Automated testing approach:1. text2. XML3. Object

4

What is SOAP webserviceComunication

<request>

Webservicehttp://endpoint

OperationAAAOperationBBB

<response>

Client SOAP

5

6

What is SOAP webservicerequest response

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > <soap:Body> <GetWeather xmlns="http://www.webserviceX.NET"> <CityName>gdansk</CityName> <CountryName>poland</CountryName> </GetWeather> </soap:Body></soap:Envelope>

<soap:Envelope ...><CurrentWeather> <Location>Gdansk-Rebiechowo, Poland (EPGD) 54-23N 018-28E 138M</Location> <Time>Jun 08, 2015 - 06:00 AM EDT</Time> <Wind>from the NW</Wind> <Visibility>greater than 7 mile(s):0</Visibility> <SkyConditions>partly cloudy</SkyConditions> <Temperature>60 F (16 C)</Temperature> <RelativeHumidity>51%</RelativeHumidity> <Pressure>30.30 in. Hg (1026 hPa)</Pressure> <Status>Success</Status></CurrentWeather>

payload

8

Manual approach – when is sufficient

Valid payloads providedOne time testThe same version of contractArtifacts (WSDL or client stub classes) not available

TESTING WEB SERVICES (SOAP) - PIOTR BOHO 9

Manual approach – live scenarios

Requests with frequently changes data e.g. DateTest flow requires dependent webservise callsBig responses like 5MB to validate

TESTING WEB SERVICES (SOAP) - PIOTR BOHO 10

Manual approach - tests maintanance problem

Application under development changes !

Refactoring:◦ Namespaces◦ Tag names

Functional change:◦ Move element◦ Add element◦ change schema constraint :

optional/required, order of elements, number of elements, change type or pattern

11

Programming approaches

1.Xml as text – string builders, parametrization, parsers regex,

2.Xml as DOM – DOM builders and xPath etc

3.Xml as serialized object – OOP and JAXB

13

Payload as serialized object Request validation using schema from WSDL Get rid of XML as text – lets use OOP

◦ Early and strict change detection - Compiler

Preparing client stub:◦ java org.apache.axis.wsdl.WSDL2Java◦ wsimport from JDK◦ Maven cxf-codegen-plugin

16

17

18

Q&A

org.apache.cxf.jaxws.JaxWsProxyFactoryBean

[email protected]