web services automation from sketch

Post on 29-Nov-2014

134 Views

Category:

Software

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

by Mykola Tverdohlib, Senior Test Automation Engineer, SoftServe

TRANSCRIPT

Web services automation from sketch

Web services?

Two main standards for web services

• REST

• SOAP

REST

• Rather an architecture style, not a standard

• Data and functionality are considered resources and are accessed

using Uniform Resource Identifiers

• Works over HTTP (CRUD)

SOAP

• Pure standard

• Relies on XML information set for its message format

• Based on sending/receiving messages

<?xml version="1.0"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header/> <soap:Body>

</soap:Body></soap:Envelope>

How SOAP works

+

How to build a framework

• Create interaction between end user and a framework

• Fill XML template with data

• Send XML request to server

• Validate XML response from server and return it to user

• Create a class responsible for parsing response

• Create a class representing XML template

• Associate class with XML template

• Create a util that fulfills XML template with a data from class

• Create Soap Client based on javax library

• Create class simulating response from server

Creating tests

+

Assertions

Login into application. Request<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">

<SOAP-ENV:Body><Authenticate xmlns="urn:MySOAPService">

<userName>admin</userName><password>admin_password</password>

</Authenticate ></SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Login into application. Response<AuthenticateResponse>

<Status>OK</Status><session>sdlkfjJISDUhklds67skadjli</session>

</AuthenticateResponse>

Create a user. Request<CreateUser xmlns="urn:MySOAPService">

<userName>dart</userName><password>dart_password</password><email>dart@uni.com</email>

</CreateUser>

Create a user. Response<CreateUserResponse>

<Status>OK</Status><UserId>52345</UserId>

</CreateUserResponse>

Go beyond

• Continuous Integration

• End to end automation in case of desktop and web

architecture

top related