SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Adjusting Page-Object approach
for Web Services Test Automation
by Sergey Poritskiy
Presenter
Sergey Poritskiy
Test automation engineer
in EPAM from 2015
projects: Parallels, Datalex
sergey_poritskiy@epam.com
skype: sergey.poritskiy
The goals
After this presentation you will have one more (of first one) practical example
of implementing test automation framework for testing web services, that:
- is easy to understand for you and newcomers
- was implemented on practice and have shown good results
- requires minimal technical expertise from your side
Starting conditions - what did I have
- No test automation on a stream (sub-project)
- Some kind of automation on other streams
- Customer wants BDD + Scrum process
- Some freedom of choice inside the stream
- Junior newcomers
Web services test automation tools and why I didn’t take them
- Custom KDT approach (TAF + Excel)
- SoapUI (SoapUITestCaseRunner for Java)
- JAXB: WSDL (or builder pattern) => POJO
’Classic’ test framework layers in UI test automation
Test scripts
Services
Page-objects
WebDriver
’Classic’ page-object example
public class LoginPage extends Page {
private static final By INPUT_LOGIN_LOCATOR = By.xpath("//input[@name='login']");
private static final By INPUT_PASSWORD_LOCATOR = By.xpath("//input[@name='passwd']");
private static final By BUTTON_SUBMIT_LOCATOR = By.xpath("//span/button[@type='submit']");
public void open() {
driver.get(URL);
}
public void typeUserName(String userName) {
driver.findElement(INPUT_LOGIN_LOCATOR).sendKeys(userName);
}
public void typePassword(String password) {
driver.findElement(INPUT_PASSWORD_LOCATOR).sendKeys(password);
}
public void clickSubmit() {
driver.findElement(BUTTON_SUBMIT_LOCATOR).click();
}
}
Our test framework layers
Test scripts
Step definitions
RX objects
Xml modifier
What is 'RxObject'?
Request / Response
->
Rq / Rs
->
Rx!
Layer 1
Test scripts
Scenarios (Cucumber)
Scenario Outline: Scenario 1 - AirAvailabilityRQ request can be successfully processed
Given User sends AirAvailabilityRQ request with following parameters
| Origin | Destination | Date | AdtQty | ChildQty | InfQty | ClientId |
| <Origin> | <Destination> | 15 | <AdtQty> | <ChildQty> | <InfQty> | <ClientId> |
And User gets successful AirAvailabilityRQ response
And Flight results in AirAvailabilityRQ are not empty
@regression
Examples:
| Origin | Destination | AdtQty | ChildQty | InfQty | ClientId |
| NYC | FRA | 1 | 2 | 0 | LH_A-NYC_MKI-I_US |
| FRA | AMS | 1 | 1 | 1 | LH_A-FRA_MKI-K_DE |
| DXB | NYC | 2 | 1 | 1 | LH_A-DXB_MKI-I_AE |
Layer 2
Step definitions
Step definitions
public class CommonTestSteps {
private RxStore store = RxStore.getInstance();
@Given("^User sends(sw+|)(sw+RQ) request$")
public void userSendsRequest(String rqNumber, String requestType){
Request request = (Request) store.getRxObject(requestType);
store.putRequest(request.getType(), request);
Response response = request.send();
store.putResponse(response.getType(), response, rqNumber);
}
@And("^User gets successful(sw+|) (w+RS)?(?: response|)$")
public void userGetsSuccessResponse(String rsNumber, String responseType) {
Response response = (Response) store.getRxObjectByNumber(responseType, rsNumber);
Assert.assertTrue(response.isSuccessful(), response.getType() + "was not successful!");
}
@And("^(w+) results in(sw+)? (w+RS)(?: response|) are not empty$")
public void resultsNotEmpty(String resultsType, String rsNumber, String responseType) {
Response response = (Response) store.getRxObjectByNumber(responseType, rsNumber);
Assert.assertTrue(response.isResultPresent(resultsType), resultsType + " results are empty!");
}
Layer 3
RX objects
RxObject
public class RxObject {
private String type;
private Document body;
public RxObject(String type, Document body) {
this.type = type;
this.body = body;
}
public String getType() {
return type;
}
public Document getBody() {
return body;
}
public String getNodeValue(String nodeLocator){
return XmlHelper.getNodeText(body, nodeLocator);
}
public boolean isNodePresent(String nodeLocator){
return XmlHelper.isNodePresent(body, nodeLocator);
}
public int getNodesCount(String nodeLocator) {
return XmlHelper.getCountNodesInDocument(body, nodeLocator);
}
}
Request Object
public abstract class Request extends RxObject {
public Request(String requestType) {
super(requestType, XmlHelper.createDocFromFile(NameHelper.getSampleFilePath(requestType)));
}
public abstract void setRequestParameterValue(String nameOfParam, String valueOfParam);
public abstract Response send() throws RequestSendException;
public void changeNodeValue(String locator, String value) {
XmlHelper.changeNodeInDocument(getBody(), locator, value);
}
public void duplicateNode(String locator) {
XmlHelper.duplicateNodeInDocument(getBody(), locator);
}
public void deleteNode(String locator) {
XmlHelper.removeNodeFromDocument(getBody(), locator);
}
}
Response Object
public abstract class Response extends RxObject {
public Response(String type, Document body) {
super(type, body);
}
public abstract boolean isResultPresent(String resultsType);
public abstract String getOfferId();
}
Request Object - dummy (sample)
Request Object - example
public class FunctionalCacheRequest extends Request {
private static final String KEY_LOCATOR = "//Key/text()";
private static final String PRICE_LOCATOR = "//PriceOption/@RateTotalAmount";
public void increaseOfferPrice(int priceCoefficient) {
double newPrice = priceCoefficient + getPrice();
setPrice(String.valueOf(newPrice));
}
public void setPrice(String value) {
changeNodeValue(PRICE_LOCATOR, value);
}
public void setKey(String key) {
changeNodeValue(KEY_LOCATOR, key);
}
public double getPrice() {
return Double.parseDoube(XmlHelper.getNodeText(getBody(), PRICE_LOCATOR));
}
@Override
public FunctionalCacheResponse send() {
return new FunctionalCacheResponse(SoapSender.sendXmlRequest(this));
}
Response Object - example
public class FunctionalCacheResponse extends Response implements HavingOfferPrice {
private static final String MESSAGE_LOCATOR = "//Message/text()";
private static final String ERROR_LOCATOR = "//Error/text()";
private static final String PRICE_LOCATOR = "//PriceOption/@RateTotalAmount";
private static final String OFFER_ID_LOCATOR = "//OfferId";
public String getMessageText() {
return getNodeValue(MESSAGE_LOCATOR);
}
public String getErrorText() {
return getNodeValue(ERROR_LOCATOR);
}
public double getOfferPrice() {
return Double.parseDouble(getNodeValue(PRICE_LOCATOR));
}
public String getOfferId() {
return getNodeValue(OFFER_ID_LOCATOR);
}
}
Layer 4
Xml modifier
XmlHelper
public class XmlHelper {
private static final String NODE_NAME_REGEX =
"(?<!['"][w/-]{1,255})(?<=[(/[:]|(and|or)s)[a-z_]+b(?![(':-])";
private static final String FORMATTING_PATTERN = "*[local-name()='%s']";
private static String makeXpathLocatorNameSpaceIgnoring(String xpathLocator) {…}
private static NodeList getNodeListByXpath(Document doc, String locator) {…}
private static Node getXmlNodeByXpath(Document doc, String locator) {…}
public static boolean isNodePresent(Document doc, String locator) {…}
public static String getNodeText(Document doc, String locator) {…}
public static void changeNodeInDocument(Document doc, String locator, String value) {…}
public static int countNodesInDocument(Document doc, String locator) {…}
public static void removeNodeFromDocument(Document doc, String locator) {…}
public static void duplicateNodeInDocument(Document doc, String locator) {…}
...
...
...
Benefits of this approach
- very simple to understand, read and write tests (KISS principle)
- has lower entrance level
- friendly for automation engineers without experience in web services testing
- doesn’t need WSDL’s that are not always available
- was successfully implemented on real project and shows good results
Questions, contacts
Questions?
sergey_poritskiy@epam.com
skype: sergey.poritskiy
MY CONTACTS
Sergey_Poritskiy@epam.com
sergey.poritskiy
Thanks!
Thanks!
Thanks!
Secret page!!!

Weitere ähnliche Inhalte

Was ist angesagt?

Codecamp iasi-26 nov 2011-what's new in jpa 2.0
Codecamp iasi-26 nov 2011-what's new in jpa 2.0Codecamp iasi-26 nov 2011-what's new in jpa 2.0
Codecamp iasi-26 nov 2011-what's new in jpa 2.0Codecamp Romania
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
 
C# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension MethodsC# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension MethodsMohammad Shaker
 
classes & objects in cpp overview
classes & objects in cpp overviewclasses & objects in cpp overview
classes & objects in cpp overviewgourav kottawar
 
Enterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platformEnterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platformIlia Idakiev
 
Operator overloading
Operator overloadingOperator overloading
Operator overloadingKumar
 
Lec 26.27-operator overloading
Lec 26.27-operator overloadingLec 26.27-operator overloading
Lec 26.27-operator overloadingPrincess Sam
 
Operator overloading and type conversions
Operator overloading and type conversionsOperator overloading and type conversions
Operator overloading and type conversionsAmogh Kalyanshetti
 
04. constructor & destructor
04. constructor & destructor04. constructor & destructor
04. constructor & destructorHaresh Jaiswal
 
Operator overloading and type conversion in cpp
Operator overloading and type conversion in cppOperator overloading and type conversion in cpp
Operator overloading and type conversion in cpprajshreemuthiah
 
Functional programming in Javascript
Functional programming in JavascriptFunctional programming in Javascript
Functional programming in JavascriptKnoldus Inc.
 
Operator overloading
Operator overloadingOperator overloading
Operator overloadingKamal Acharya
 

Was ist angesagt? (20)

Codecamp iasi-26 nov 2011-what's new in jpa 2.0
Codecamp iasi-26 nov 2011-what's new in jpa 2.0Codecamp iasi-26 nov 2011-what's new in jpa 2.0
Codecamp iasi-26 nov 2011-what's new in jpa 2.0
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
C# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension MethodsC# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension Methods
 
Hems
HemsHems
Hems
 
Unary operator overloading
Unary operator overloadingUnary operator overloading
Unary operator overloading
 
Tolog Updates
Tolog UpdatesTolog Updates
Tolog Updates
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
Linq
LinqLinq
Linq
 
classes & objects in cpp overview
classes & objects in cpp overviewclasses & objects in cpp overview
classes & objects in cpp overview
 
Enterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platformEnterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platform
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Lec 26.27-operator overloading
Lec 26.27-operator overloadingLec 26.27-operator overloading
Lec 26.27-operator overloading
 
Operator overloading and type conversions
Operator overloading and type conversionsOperator overloading and type conversions
Operator overloading and type conversions
 
Anonymous functions in JavaScript
Anonymous functions in JavaScriptAnonymous functions in JavaScript
Anonymous functions in JavaScript
 
Cocoa heads 09112017
Cocoa heads 09112017Cocoa heads 09112017
Cocoa heads 09112017
 
04. constructor & destructor
04. constructor & destructor04. constructor & destructor
04. constructor & destructor
 
Operator overloading and type conversion in cpp
Operator overloading and type conversion in cppOperator overloading and type conversion in cpp
Operator overloading and type conversion in cpp
 
LINQ
LINQLINQ
LINQ
 
Functional programming in Javascript
Functional programming in JavascriptFunctional programming in Javascript
Functional programming in Javascript
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 

Ähnlich wie Применение паттерна Page Object для автоматизации веб сервисов

Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsGuy Nir
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every dayVadym Khondar
 
Easy rest service using PHP reflection api
Easy rest service using PHP reflection apiEasy rest service using PHP reflection api
Easy rest service using PHP reflection apiMatthieu Aubry
 
PHP: GraphQL consistency through code generation
PHP: GraphQL consistency through code generationPHP: GraphQL consistency through code generation
PHP: GraphQL consistency through code generationAlexander Obukhov
 
Spring MVC Annotations
Spring MVC AnnotationsSpring MVC Annotations
Spring MVC AnnotationsJordan Silva
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy codeShriKant Vashishtha
 
The Full Power of ASP.NET Web API
The Full Power of ASP.NET Web APIThe Full Power of ASP.NET Web API
The Full Power of ASP.NET Web APIEyal Vardi
 
Тарас Олексин - Sculpt! Your! Tests!
Тарас Олексин  - Sculpt! Your! Tests!Тарас Олексин  - Sculpt! Your! Tests!
Тарас Олексин - Sculpt! Your! Tests!DataArt
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Functional Vaadin talk at OSCON 2014
Functional Vaadin talk at OSCON 2014Functional Vaadin talk at OSCON 2014
Functional Vaadin talk at OSCON 2014hezamu
 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09Daniel Bryant
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Michelangelo van Dam
 
Testing in android
Testing in androidTesting in android
Testing in androidjtrindade
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeMacoscope
 
Protocol-Oriented Networking
Protocol-Oriented NetworkingProtocol-Oriented Networking
Protocol-Oriented NetworkingMostafa Amer
 

Ähnlich wie Применение паттерна Page Object для автоматизации веб сервисов (20)

Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
Codemotion appengine
Codemotion appengineCodemotion appengine
Codemotion appengine
 
Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
 
Easy rest service using PHP reflection api
Easy rest service using PHP reflection apiEasy rest service using PHP reflection api
Easy rest service using PHP reflection api
 
PHP: GraphQL consistency through code generation
PHP: GraphQL consistency through code generationPHP: GraphQL consistency through code generation
PHP: GraphQL consistency through code generation
 
Spring MVC Annotations
Spring MVC AnnotationsSpring MVC Annotations
Spring MVC Annotations
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy code
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
The Full Power of ASP.NET Web API
The Full Power of ASP.NET Web APIThe Full Power of ASP.NET Web API
The Full Power of ASP.NET Web API
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Тарас Олексин - Sculpt! Your! Tests!
Тарас Олексин  - Sculpt! Your! Tests!Тарас Олексин  - Sculpt! Your! Tests!
Тарас Олексин - Sculpt! Your! Tests!
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Functional Vaadin talk at OSCON 2014
Functional Vaadin talk at OSCON 2014Functional Vaadin talk at OSCON 2014
Functional Vaadin talk at OSCON 2014
 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010
 
Testing in android
Testing in androidTesting in android
Testing in android
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, Macoscope
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
Protocol-Oriented Networking
Protocol-Oriented NetworkingProtocol-Oriented Networking
Protocol-Oriented Networking
 

Mehr von COMAQA.BY

Тестирование аналогов инсталлируемых приложений (Android Instant Apps, Progre...
Тестирование аналогов инсталлируемых приложений (Android Instant Apps, Progre...Тестирование аналогов инсталлируемых приложений (Android Instant Apps, Progre...
Тестирование аналогов инсталлируемых приложений (Android Instant Apps, Progre...COMAQA.BY
 
Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...
Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...
Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...COMAQA.BY
 
Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...
Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...
Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...COMAQA.BY
 
Roman Soroka. Comaqa Spring 2018. Глобальный обзор процесса QA и его важность
Roman Soroka. Comaqa Spring 2018. Глобальный обзор процесса QA и его важностьRoman Soroka. Comaqa Spring 2018. Глобальный обзор процесса QA и его важность
Roman Soroka. Comaqa Spring 2018. Глобальный обзор процесса QA и его важностьCOMAQA.BY
 
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...COMAQA.BY
 
Vladimir Polyakov. Comaqa Spring 2018. Особенности тестирования ПО в предметн...
Vladimir Polyakov. Comaqa Spring 2018. Особенности тестирования ПО в предметн...Vladimir Polyakov. Comaqa Spring 2018. Особенности тестирования ПО в предметн...
Vladimir Polyakov. Comaqa Spring 2018. Особенности тестирования ПО в предметн...COMAQA.BY
 
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...COMAQA.BY
 
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...COMAQA.BY
 
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.COMAQA.BY
 
Vadim Zubovich. Comaqa Spring 2018. Красивое тестирование производительности.
Vadim Zubovich. Comaqa Spring 2018. Красивое тестирование производительности.Vadim Zubovich. Comaqa Spring 2018. Красивое тестирование производительности.
Vadim Zubovich. Comaqa Spring 2018. Красивое тестирование производительности.COMAQA.BY
 
Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...
Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...
Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...COMAQA.BY
 
Моя роль в конфликте
Моя роль в конфликтеМоя роль в конфликте
Моя роль в конфликтеCOMAQA.BY
 
Организация приемочного тестирования силами матерых тестировщиков
Организация приемочного тестирования силами матерых тестировщиковОрганизация приемочного тестирования силами матерых тестировщиков
Организация приемочного тестирования силами матерых тестировщиковCOMAQA.BY
 
Развитие или смерть
Развитие или смертьРазвитие или смерть
Развитие или смертьCOMAQA.BY
 
Системный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестовСистемный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестовCOMAQA.BY
 
Эффективная работа с рутинными задачами
Эффективная работа с рутинными задачамиЭффективная работа с рутинными задачами
Эффективная работа с рутинными задачамиCOMAQA.BY
 
Как стать синьором
Как стать синьоромКак стать синьором
Как стать синьоромCOMAQA.BY
 
Open your mind for OpenSource
Open your mind for OpenSourceOpen your mind for OpenSource
Open your mind for OpenSourceCOMAQA.BY
 
JDI 2.0. Not only UI testing
JDI 2.0. Not only UI testingJDI 2.0. Not only UI testing
JDI 2.0. Not only UI testingCOMAQA.BY
 
Out of box page object design pattern, java
Out of box page object design pattern, javaOut of box page object design pattern, java
Out of box page object design pattern, javaCOMAQA.BY
 

Mehr von COMAQA.BY (20)

Тестирование аналогов инсталлируемых приложений (Android Instant Apps, Progre...
Тестирование аналогов инсталлируемых приложений (Android Instant Apps, Progre...Тестирование аналогов инсталлируемых приложений (Android Instant Apps, Progre...
Тестирование аналогов инсталлируемых приложений (Android Instant Apps, Progre...
 
Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...
Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...
Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...
 
Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...
Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...
Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...
 
Roman Soroka. Comaqa Spring 2018. Глобальный обзор процесса QA и его важность
Roman Soroka. Comaqa Spring 2018. Глобальный обзор процесса QA и его важностьRoman Soroka. Comaqa Spring 2018. Глобальный обзор процесса QA и его важность
Roman Soroka. Comaqa Spring 2018. Глобальный обзор процесса QA и его важность
 
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
 
Vladimir Polyakov. Comaqa Spring 2018. Особенности тестирования ПО в предметн...
Vladimir Polyakov. Comaqa Spring 2018. Особенности тестирования ПО в предметн...Vladimir Polyakov. Comaqa Spring 2018. Особенности тестирования ПО в предметн...
Vladimir Polyakov. Comaqa Spring 2018. Особенности тестирования ПО в предметн...
 
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
 
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
 
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
 
Vadim Zubovich. Comaqa Spring 2018. Красивое тестирование производительности.
Vadim Zubovich. Comaqa Spring 2018. Красивое тестирование производительности.Vadim Zubovich. Comaqa Spring 2018. Красивое тестирование производительности.
Vadim Zubovich. Comaqa Spring 2018. Красивое тестирование производительности.
 
Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...
Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...
Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...
 
Моя роль в конфликте
Моя роль в конфликтеМоя роль в конфликте
Моя роль в конфликте
 
Организация приемочного тестирования силами матерых тестировщиков
Организация приемочного тестирования силами матерых тестировщиковОрганизация приемочного тестирования силами матерых тестировщиков
Организация приемочного тестирования силами матерых тестировщиков
 
Развитие или смерть
Развитие или смертьРазвитие или смерть
Развитие или смерть
 
Системный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестовСистемный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестов
 
Эффективная работа с рутинными задачами
Эффективная работа с рутинными задачамиЭффективная работа с рутинными задачами
Эффективная работа с рутинными задачами
 
Как стать синьором
Как стать синьоромКак стать синьором
Как стать синьором
 
Open your mind for OpenSource
Open your mind for OpenSourceOpen your mind for OpenSource
Open your mind for OpenSource
 
JDI 2.0. Not only UI testing
JDI 2.0. Not only UI testingJDI 2.0. Not only UI testing
JDI 2.0. Not only UI testing
 
Out of box page object design pattern, java
Out of box page object design pattern, javaOut of box page object design pattern, java
Out of box page object design pattern, java
 

Kürzlich hochgeladen

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Kürzlich hochgeladen (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Применение паттерна Page Object для автоматизации веб сервисов

  • 1. Adjusting Page-Object approach for Web Services Test Automation by Sergey Poritskiy
  • 2. Presenter Sergey Poritskiy Test automation engineer in EPAM from 2015 projects: Parallels, Datalex sergey_poritskiy@epam.com skype: sergey.poritskiy
  • 3. The goals After this presentation you will have one more (of first one) practical example of implementing test automation framework for testing web services, that: - is easy to understand for you and newcomers - was implemented on practice and have shown good results - requires minimal technical expertise from your side
  • 4. Starting conditions - what did I have - No test automation on a stream (sub-project) - Some kind of automation on other streams - Customer wants BDD + Scrum process - Some freedom of choice inside the stream - Junior newcomers
  • 5. Web services test automation tools and why I didn’t take them - Custom KDT approach (TAF + Excel) - SoapUI (SoapUITestCaseRunner for Java) - JAXB: WSDL (or builder pattern) => POJO
  • 6. ’Classic’ test framework layers in UI test automation Test scripts Services Page-objects WebDriver
  • 7. ’Classic’ page-object example public class LoginPage extends Page { private static final By INPUT_LOGIN_LOCATOR = By.xpath("//input[@name='login']"); private static final By INPUT_PASSWORD_LOCATOR = By.xpath("//input[@name='passwd']"); private static final By BUTTON_SUBMIT_LOCATOR = By.xpath("//span/button[@type='submit']"); public void open() { driver.get(URL); } public void typeUserName(String userName) { driver.findElement(INPUT_LOGIN_LOCATOR).sendKeys(userName); } public void typePassword(String password) { driver.findElement(INPUT_PASSWORD_LOCATOR).sendKeys(password); } public void clickSubmit() { driver.findElement(BUTTON_SUBMIT_LOCATOR).click(); } }
  • 8. Our test framework layers Test scripts Step definitions RX objects Xml modifier
  • 9. What is 'RxObject'? Request / Response -> Rq / Rs -> Rx!
  • 11. Scenarios (Cucumber) Scenario Outline: Scenario 1 - AirAvailabilityRQ request can be successfully processed Given User sends AirAvailabilityRQ request with following parameters | Origin | Destination | Date | AdtQty | ChildQty | InfQty | ClientId | | <Origin> | <Destination> | 15 | <AdtQty> | <ChildQty> | <InfQty> | <ClientId> | And User gets successful AirAvailabilityRQ response And Flight results in AirAvailabilityRQ are not empty @regression Examples: | Origin | Destination | AdtQty | ChildQty | InfQty | ClientId | | NYC | FRA | 1 | 2 | 0 | LH_A-NYC_MKI-I_US | | FRA | AMS | 1 | 1 | 1 | LH_A-FRA_MKI-K_DE | | DXB | NYC | 2 | 1 | 1 | LH_A-DXB_MKI-I_AE |
  • 13. Step definitions public class CommonTestSteps { private RxStore store = RxStore.getInstance(); @Given("^User sends(sw+|)(sw+RQ) request$") public void userSendsRequest(String rqNumber, String requestType){ Request request = (Request) store.getRxObject(requestType); store.putRequest(request.getType(), request); Response response = request.send(); store.putResponse(response.getType(), response, rqNumber); } @And("^User gets successful(sw+|) (w+RS)?(?: response|)$") public void userGetsSuccessResponse(String rsNumber, String responseType) { Response response = (Response) store.getRxObjectByNumber(responseType, rsNumber); Assert.assertTrue(response.isSuccessful(), response.getType() + "was not successful!"); } @And("^(w+) results in(sw+)? (w+RS)(?: response|) are not empty$") public void resultsNotEmpty(String resultsType, String rsNumber, String responseType) { Response response = (Response) store.getRxObjectByNumber(responseType, rsNumber); Assert.assertTrue(response.isResultPresent(resultsType), resultsType + " results are empty!"); }
  • 15. RxObject public class RxObject { private String type; private Document body; public RxObject(String type, Document body) { this.type = type; this.body = body; } public String getType() { return type; } public Document getBody() { return body; } public String getNodeValue(String nodeLocator){ return XmlHelper.getNodeText(body, nodeLocator); } public boolean isNodePresent(String nodeLocator){ return XmlHelper.isNodePresent(body, nodeLocator); } public int getNodesCount(String nodeLocator) { return XmlHelper.getCountNodesInDocument(body, nodeLocator); } }
  • 16. Request Object public abstract class Request extends RxObject { public Request(String requestType) { super(requestType, XmlHelper.createDocFromFile(NameHelper.getSampleFilePath(requestType))); } public abstract void setRequestParameterValue(String nameOfParam, String valueOfParam); public abstract Response send() throws RequestSendException; public void changeNodeValue(String locator, String value) { XmlHelper.changeNodeInDocument(getBody(), locator, value); } public void duplicateNode(String locator) { XmlHelper.duplicateNodeInDocument(getBody(), locator); } public void deleteNode(String locator) { XmlHelper.removeNodeFromDocument(getBody(), locator); } }
  • 17. Response Object public abstract class Response extends RxObject { public Response(String type, Document body) { super(type, body); } public abstract boolean isResultPresent(String resultsType); public abstract String getOfferId(); }
  • 18. Request Object - dummy (sample)
  • 19. Request Object - example public class FunctionalCacheRequest extends Request { private static final String KEY_LOCATOR = "//Key/text()"; private static final String PRICE_LOCATOR = "//PriceOption/@RateTotalAmount"; public void increaseOfferPrice(int priceCoefficient) { double newPrice = priceCoefficient + getPrice(); setPrice(String.valueOf(newPrice)); } public void setPrice(String value) { changeNodeValue(PRICE_LOCATOR, value); } public void setKey(String key) { changeNodeValue(KEY_LOCATOR, key); } public double getPrice() { return Double.parseDoube(XmlHelper.getNodeText(getBody(), PRICE_LOCATOR)); } @Override public FunctionalCacheResponse send() { return new FunctionalCacheResponse(SoapSender.sendXmlRequest(this)); }
  • 20. Response Object - example public class FunctionalCacheResponse extends Response implements HavingOfferPrice { private static final String MESSAGE_LOCATOR = "//Message/text()"; private static final String ERROR_LOCATOR = "//Error/text()"; private static final String PRICE_LOCATOR = "//PriceOption/@RateTotalAmount"; private static final String OFFER_ID_LOCATOR = "//OfferId"; public String getMessageText() { return getNodeValue(MESSAGE_LOCATOR); } public String getErrorText() { return getNodeValue(ERROR_LOCATOR); } public double getOfferPrice() { return Double.parseDouble(getNodeValue(PRICE_LOCATOR)); } public String getOfferId() { return getNodeValue(OFFER_ID_LOCATOR); } }
  • 22. XmlHelper public class XmlHelper { private static final String NODE_NAME_REGEX = "(?<!['"][w/-]{1,255})(?<=[(/[:]|(and|or)s)[a-z_]+b(?![(':-])"; private static final String FORMATTING_PATTERN = "*[local-name()='%s']"; private static String makeXpathLocatorNameSpaceIgnoring(String xpathLocator) {…} private static NodeList getNodeListByXpath(Document doc, String locator) {…} private static Node getXmlNodeByXpath(Document doc, String locator) {…} public static boolean isNodePresent(Document doc, String locator) {…} public static String getNodeText(Document doc, String locator) {…} public static void changeNodeInDocument(Document doc, String locator, String value) {…} public static int countNodesInDocument(Document doc, String locator) {…} public static void removeNodeFromDocument(Document doc, String locator) {…} public static void duplicateNodeInDocument(Document doc, String locator) {…} ... ... ...
  • 23. Benefits of this approach - very simple to understand, read and write tests (KISS principle) - has lower entrance level - friendly for automation engineers without experience in web services testing - doesn’t need WSDL’s that are not always available - was successfully implemented on real project and shows good results