SlideShare une entreprise Scribd logo
1  sur  57
Télécharger pour lire hors ligne
Easy:) Tests with Selenide and Easyb

Iakiv Kramarenko
Conventions :)
●

Sympathy colors***:
Green

=

Orange

Red

=

=

*** often are subjective and applied to specific context ;)
●

At project with no Web UI automation, no unit testing

●

With 4(5) Manual QA
–

●

Using checklists + long detailed End to End test cases

With 1 QA Automation found
Testing single page web app
●

Ajax

●

only <div>, <a>, <input>
–

Inconsistent implementation

●

No confident urls

●

One current Frame/Page with content per user step
–

Deep structure:
●

–

Authorization > Menus > SubMenus > Tabs > Extra > Extra

Modal dialogs
Met Requirements
●

Automate high level scenarios
–
–

●

use AC from stories
existed Manual Scenarios

Use 3rd party solutions
–

●

Java Desired

Involve Manual QA
–
–

●

provide easy to use solution
BDD Desired

In Tough Deadlines :)
Dreaming of framework...
●

Fast in development
–

Using instruments quite agile to adapt to project specifics

●

Extremely easy to use and learn

●

Simple DSL for tests

●

BDD – light and DRY as
much as possible
“Raw” Webdriver with tunings
(HtmlElements, Matchers, etc.)
●

No convenient and concise Ajax support out of the box

●

Code redundancy
–

Driver creation

–

Finding elements

–

Assert element states
●

Harmcrest Matchers are easy, but assertThat() knows nothing
about Ajax
–

HtmlElements gives powerful but bulky “waiting” decorators
(see links [1][2])
Concordion
●

Hard to extend
–

Custom commands (asserts)

<html xmlns:concordion="http://www.concordion.org/2007/concordion">
<body>
<p concordion:assertEquals="getGreeting()">Hello World!</p>
</body>
</html>
Thucydides
●

No convenient Ajax support
–

Asserts and Conditions are bound
●

●

Framework, not a Lib
–

Not agile
●

●

Hard to extend

It's hard to use some patterns (e.g. LoadableComponent)

Monstrous Manual :)
= Redundancy
Not BDD
Easy:) Instruments
@Test
public void userCanLoginByUsername() {
open("/login");
$(By.name("user.name")).setValue("johny");
$("#submit").click();
$(".loading_progress").should(disappear);
$("#username").shouldHave(text("Hello, Johny!"));
}
Selenide Pros
●

Wrapper over Selenium with Concise API

●

Lib, not a Framework
–

●

You still have your raw WebDriver when needed

should style asserts
–

Independent from Conditions

–

Waiting for conditions (Ajax friendly)

●

Screenshot reporting on each failed should

●

Screenshot API
–
–

●

Providing screenshots' context
Get all screenshots for context

Actively supported by authors
Killer Feature
Selenide Conditions
public static final Condition checked = new Condition("checked") {
@Override
public boolean apply(WebElement element) {
return isChecked(element);
}

@Override
public String actualValue(WebElement element) {
return isChecked(element) ? "checked" : "unchecked";
}

@Override
public String toString(){
return "checked";
}
};
Or even shorter
public static final Condition checked = new Condition("checked") {

@Override
public boolean apply(WebElement element) {

return isChecked(element);
}
};
Custom Condition Examples
Aliases
Implementation
public static final Condition checked =
Condition.hasClass("checked");

public static final Condition enabled =
Condition.hasNotClass("disabled");

public static final Condition expanded =
Condition.attribute("area-expanded", "true");
Usage
showPasswordCheckBox().shouldBe(not(checked));

applyButton().shouldBe(enabled);

treeItem.shouldBe(expanded);
Usage: is
public static void ensureExpanded(SelenideElement item){
if (item.is(not(expanded))){

}
}

expand(item);
Own implementation
Implementation (1)
public static final Condition inRadioMode(final String radioMode){
return new Condition("in radio mode: " + radioMode) {
@Override
public boolean apply(WebElement webElement) {
boolean res = true;
for(WebElement mode: Mode.modes(webElement)){
if (Mode.value(mode).equals(radioMode)){
res = res &&
mode.getAttribute("class").contains("active");

} else {
res = res && !
}

}

}
};

}
return res;

mode.getAttribute("class").contains("active");
Implementation (2)
public static final Condition faded = new Condition("faded
with backdrop" )
{
@Override
public boolean apply(WebElement element) {
return backDropFor(element).exists();
}
};
Implementation (3)
public static Condition leftSliderPosition(final Integer
position)
{
return new Condition("left slider position " + position)
{

@Override
public boolean apply(WebElement webElement) {
return

getLeftSliderCurrentPosition(webElement).equals(position);
}
};
}
Usage
tabContainer().shouldBe(faded);

accessRadioButtons().shouldBe(inRadioMode(PRIVATE));

scheduler.shouldHave(leftSliderPosition(100));
Composition*

* public static final will be omitted for simplicity
Implementation
Condition loadingDialog = condition(loadingDialog(), exist);
Condition applyButtonDisabled = condition(primeBtn(), disabled);
Condition cancelButtonDisabled = condition(scndBtn(), disabled);

Condition processed = with_(no(Modal.dialog()));
Condition loaded = and(processed, with_(no(loadingDialog)),
with_(applyButtonDisabled));
Condition savedForSure = and(loaded, with_(saveSuccessMsg()));
Condition failedToSave = and(
processed,
with_(no(loadingDialog)),
with_(not(applyButtonDisabled)),
with_(no(saveSuccessMsg())),
with_(not(cancelButtonDisabled)),
with_(saveErrorsMsg()));
Usage
//fill page with valid/invalid data...

Page.save()
Page.shouldBe(and(
failedToSave,
with(usernameValidation(), currentPassValidation()),
with(no(newPassValidation(), matchPassValidation()))))

//fix errors and save...

Page.shouldBe(savedForSure)
Selenide Cons
●

Young:)
–

Many things can be improved
●

Error messages

●

Condition helpers

●

Screenshot API

–
–

●

Tones of them have been resolved so far
Others can be implemented as your own extensions

Not all-powerfull
–

For some things you will still need raw WebDriver
Easyb Pros
●

Gherkin (given/when/then) and its implementation live at
the same file
–

better maintainability

–

more DRY code

●

no implementation => “pending” test

●

simple but nice looking reports

●

groovy as a script language for tests
–

scenarios are ordered
Easyb Cons
●

bad support of framework from authors.

●

some features are broken
–

●

no tags per scenario/step
–

●
●

●

before_each
only tags per story

Stack trace of error messages is clipped
No out of the box way to put listeners on
steps/scenarios
“Shared steps” feature is present but not quite
handy
Easyb Selenide Integration
Problem
Selenide shoulds vs Easyb shoulds
Easyb catches any 'should' (shouldBe, shouldHave, ...)
except “should” and “shouldNot”

showPasswordCheckBox().shouldNot(checked);
//Less readable:(
Solution => Decorators
showPasswordCheckBox().shouldNot(be(checked));
showPasswordCheckBox().should(be(not(checked)));
All Together :)
Preconditions to BDD
Team is competent :)

●

●

PO knows what is
Criteria of Good Requirement
Manual QA knows how to write
“Automatable” Scenarios
Pending Easyb Story by PO
description "Products List page"
scenario "Add new product", {
given "On Products List page"
then "new product can be added"
}
Pending Detailed Easyb Story by
Manual QA
description "Products List page"
scenario "Add new product", {
given "On Products List page"
and "No custom product with 'Product_1' name exist"
then "new product with 'Product_1' name can be added"
and "after relogin still present"
}
Implemented Easyb Story
description "ProductsList test"
tags "functional"
BaseTest.setup()
scenario "Add new product", {
given "On ProductsList page",{
ProductsList.page().get()
}
and "No custom product with '" + TEST_PRODUCT + "' name exist", {
Table.ensureHasNo(cellByText(TEST_PRODUCT))
}
then "new product with '" + TEST_PRODUCT + "' name can be added", {
ProductsList.addProductForSure(TEST_PRODUCT)
}
and "after relogin still present", {
cleanReLogin()
Table.cellByText(TEST_PRODUCT).should(be(visible));
}
}
Easyb Report
Failed
Easyb
Report
Alternative: TestNG test
public class ProductManagement extends AbstractTest {
@Test
public void testNewProductCanBeAdded() {
ProductsList.page().get();
Table.ensureHasNo(cellByText(TEST_PRODUCT));
ProductsList.addProductForSure(TEST_PRODUCT);
cleanReLogin();
Table.cellByText(TEST_PRODUCT).should(Be.visible);
}
}
Alternative: TestNG Report
Failed TestNG Report
When Easyb ?
●

“Somebody” wants Gherkin
–

Automation resources are
limited, and help may come from
PO or Manual QA providing
detailed 'steps to code'

●

Detailed reporting of test steps

●

Ordered tests execution (as present in the file)
When TestNG/Junit ?
●

When you have strong 'agile' devs/automation which know why
what and how to test and do write tests.
–

Hence you never need pretty looking reports to please your
manager customer because you just have high quality product.
Ideas for improvements
●

Kill Kenny
–

if he is the only who wants Gherkin:)

–

and stay KISS with TestNG/Junit

●

Contribute to Easyb:)

●

Bless Selenide:)
–

Authors will contribute nevertheless
Q&A
Resources, Links
●

●

●

Src of example test framework:
https://github.com/yashaka/gribletest
Application under test used in easyb examples:
http://grible.org/download.php
Instruments
–

http://selenide.org/

–

http://easyb.org/
●

To Artem Chernysh for implementation of main base part
of the test framework for this presentation
–

●

To Maksym Barvinskyi for application under test
–

●

https://github.com/elaides/gribletest
http://grible.org/

To Andrei Solntsev, creator of Selenide, for close
collaboration on Selenide Q&A, and new features
implemented:)
Contacts
●

yashaka@gmail.com

●

skype: yashaolin

●

http://www.linkedin.com/in/iakivkramarenko

Contenu connexe

Tendances

A journey beyond the page object pattern
A journey beyond the page object patternA journey beyond the page object pattern
A journey beyond the page object patternRiverGlide
 
TestNG Annotations in Selenium | Edureka
TestNG Annotations in Selenium | EdurekaTestNG Annotations in Selenium | Edureka
TestNG Annotations in Selenium | EdurekaEdureka!
 
Intro to Asynchronous Javascript
Intro to Asynchronous JavascriptIntro to Asynchronous Javascript
Intro to Asynchronous JavascriptGarrett Welson
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriverRajathi-QA
 
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | EdurekaWhat is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | EdurekaEdureka!
 
Integration testing for microservices with Spring Boot
Integration testing for microservices with Spring BootIntegration testing for microservices with Spring Boot
Integration testing for microservices with Spring BootOleksandr Romanov
 
Rest api 테스트 수행가이드
Rest api 테스트 수행가이드Rest api 테스트 수행가이드
Rest api 테스트 수행가이드SangIn Choung
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with MockitoRichard Paul
 
Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch  Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch Haitham Refaat
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
CSS3 2D/3D transform
CSS3 2D/3D transformCSS3 2D/3D transform
CSS3 2D/3D transformKenny Lee
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and StatementsWebStackAcademy
 
Page Object in XCUITest
Page Object in XCUITestPage Object in XCUITest
Page Object in XCUITestJz Chang
 

Tendances (20)

A journey beyond the page object pattern
A journey beyond the page object patternA journey beyond the page object pattern
A journey beyond the page object pattern
 
TestNG Annotations in Selenium | Edureka
TestNG Annotations in Selenium | EdurekaTestNG Annotations in Selenium | Edureka
TestNG Annotations in Selenium | Edureka
 
Intro to Asynchronous Javascript
Intro to Asynchronous JavascriptIntro to Asynchronous Javascript
Intro to Asynchronous Javascript
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
Selenium-Locators
Selenium-LocatorsSelenium-Locators
Selenium-Locators
 
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | EdurekaWhat is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
 
RxSwift to Combine
RxSwift to CombineRxSwift to Combine
RxSwift to Combine
 
Integration testing for microservices with Spring Boot
Integration testing for microservices with Spring BootIntegration testing for microservices with Spring Boot
Integration testing for microservices with Spring Boot
 
ASP.MVC Training
ASP.MVC TrainingASP.MVC Training
ASP.MVC Training
 
Rest api 테스트 수행가이드
Rest api 테스트 수행가이드Rest api 테스트 수행가이드
Rest api 테스트 수행가이드
 
Selenium Automation Framework
Selenium Automation  FrameworkSelenium Automation  Framework
Selenium Automation Framework
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
 
jQuery
jQueryjQuery
jQuery
 
Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch  Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Core Java
Core JavaCore Java
Core Java
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 
CSS3 2D/3D transform
CSS3 2D/3D transformCSS3 2D/3D transform
CSS3 2D/3D transform
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
Page Object in XCUITest
Page Object in XCUITestPage Object in XCUITest
Page Object in XCUITest
 

Similaire à Easy tests with Selenide and Easyb

Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web developmentalice yang
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance testBryan Liu
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsSami Ekblad
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testingdrewz lin
 
Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Ortus Solutions, Corp
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Mahmoud Hamed Mahmoud
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webpjcozzi
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest servicesIoan Eugen Stan
 
Hybrid App using WordPress
Hybrid App using WordPressHybrid App using WordPress
Hybrid App using WordPressHaim Michael
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF SummitOrtus Solutions, Corp
 
Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumRichard Olrichs
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 

Similaire à Easy tests with Selenide and Easyb (20)

Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web development
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance test
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open web
 
Jasmine with JS-Test-Driver
Jasmine with JS-Test-DriverJasmine with JS-Test-Driver
Jasmine with JS-Test-Driver
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
Hybrid App using WordPress
Hybrid App using WordPressHybrid App using WordPress
Hybrid App using WordPress
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
Web ui testing
Web ui testingWeb ui testing
Web ui testing
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
Automated Testing ADF with Selenium
Automated Testing ADF with SeleniumAutomated Testing ADF with Selenium
Automated Testing ADF with Selenium
 
Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with Selenium
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 

Plus de Iakiv Kramarenko

Отзывы на раннюю версию курса «Искусство Автоматизации с Java + Selenide»
Отзывы на раннюю версию курса «Искусство Автоматизации с Java + Selenide» Отзывы на раннюю версию курса «Искусство Автоматизации с Java + Selenide»
Отзывы на раннюю версию курса «Искусство Автоматизации с Java + Selenide» Iakiv Kramarenko
 
Dont be fooled with BDD, automation engineer! ;)
Dont be fooled with BDD, automation engineer! ;)Dont be fooled with BDD, automation engineer! ;)
Dont be fooled with BDD, automation engineer! ;)Iakiv Kramarenko
 
Web ui tests examples with selenide, nselene, selene & capybara
Web ui tests examples with  selenide, nselene, selene & capybaraWeb ui tests examples with  selenide, nselene, selene & capybara
Web ui tests examples with selenide, nselene, selene & capybaraIakiv Kramarenko
 
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Iakiv Kramarenko
 
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]Iakiv Kramarenko
 
You do not need automation engineer - Sqa Days - 2015 - EN
You do not need automation engineer  - Sqa Days - 2015 - ENYou do not need automation engineer  - Sqa Days - 2015 - EN
You do not need automation engineer - Sqa Days - 2015 - ENIakiv Kramarenko
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Iakiv Kramarenko
 
Write Selenide in Python 15 min
Write Selenide in Python 15 minWrite Selenide in Python 15 min
Write Selenide in Python 15 minIakiv Kramarenko
 
Automation is Easy! (python version)
Automation is Easy! (python version)Automation is Easy! (python version)
Automation is Easy! (python version)Iakiv Kramarenko
 

Plus de Iakiv Kramarenko (11)

Отзывы на раннюю версию курса «Искусство Автоматизации с Java + Selenide»
Отзывы на раннюю версию курса «Искусство Автоматизации с Java + Selenide» Отзывы на раннюю версию курса «Искусство Автоматизации с Java + Selenide»
Отзывы на раннюю версию курса «Искусство Автоматизации с Java + Selenide»
 
Dont be fooled with BDD, automation engineer! ;)
Dont be fooled with BDD, automation engineer! ;)Dont be fooled with BDD, automation engineer! ;)
Dont be fooled with BDD, automation engineer! ;)
 
Easy automation.py
Easy automation.pyEasy automation.py
Easy automation.py
 
KISS Automation.py
KISS Automation.pyKISS Automation.py
KISS Automation.py
 
Web ui tests examples with selenide, nselene, selene & capybara
Web ui tests examples with  selenide, nselene, selene & capybaraWeb ui tests examples with  selenide, nselene, selene & capybara
Web ui tests examples with selenide, nselene, selene & capybara
 
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
 
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
 
You do not need automation engineer - Sqa Days - 2015 - EN
You do not need automation engineer  - Sqa Days - 2015 - ENYou do not need automation engineer  - Sqa Days - 2015 - EN
You do not need automation engineer - Sqa Days - 2015 - EN
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015
 
Write Selenide in Python 15 min
Write Selenide in Python 15 minWrite Selenide in Python 15 min
Write Selenide in Python 15 min
 
Automation is Easy! (python version)
Automation is Easy! (python version)Automation is Easy! (python version)
Automation is Easy! (python version)
 

Dernier

Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 

Dernier (20)

Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 

Easy tests with Selenide and Easyb

  • 1. Easy:) Tests with Selenide and Easyb Iakiv Kramarenko
  • 2. Conventions :) ● Sympathy colors***: Green = Orange Red = = *** often are subjective and applied to specific context ;)
  • 3. ● At project with no Web UI automation, no unit testing ● With 4(5) Manual QA – ● Using checklists + long detailed End to End test cases With 1 QA Automation found
  • 4. Testing single page web app ● Ajax ● only <div>, <a>, <input> – Inconsistent implementation ● No confident urls ● One current Frame/Page with content per user step – Deep structure: ● – Authorization > Menus > SubMenus > Tabs > Extra > Extra Modal dialogs
  • 5. Met Requirements ● Automate high level scenarios – – ● use AC from stories existed Manual Scenarios Use 3rd party solutions – ● Java Desired Involve Manual QA – – ● provide easy to use solution BDD Desired In Tough Deadlines :)
  • 6. Dreaming of framework... ● Fast in development – Using instruments quite agile to adapt to project specifics ● Extremely easy to use and learn ● Simple DSL for tests ● BDD – light and DRY as much as possible
  • 7.
  • 8. “Raw” Webdriver with tunings (HtmlElements, Matchers, etc.) ● No convenient and concise Ajax support out of the box ● Code redundancy – Driver creation – Finding elements – Assert element states ● Harmcrest Matchers are easy, but assertThat() knows nothing about Ajax – HtmlElements gives powerful but bulky “waiting” decorators (see links [1][2])
  • 9. Concordion ● Hard to extend – Custom commands (asserts) <html xmlns:concordion="http://www.concordion.org/2007/concordion"> <body> <p concordion:assertEquals="getGreeting()">Hello World!</p> </body> </html>
  • 10. Thucydides ● No convenient Ajax support – Asserts and Conditions are bound ● ● Framework, not a Lib – Not agile ● ● Hard to extend It's hard to use some patterns (e.g. LoadableComponent) Monstrous Manual :)
  • 14.
  • 15. @Test public void userCanLoginByUsername() { open("/login"); $(By.name("user.name")).setValue("johny"); $("#submit").click(); $(".loading_progress").should(disappear); $("#username").shouldHave(text("Hello, Johny!")); }
  • 16. Selenide Pros ● Wrapper over Selenium with Concise API ● Lib, not a Framework – ● You still have your raw WebDriver when needed should style asserts – Independent from Conditions – Waiting for conditions (Ajax friendly) ● Screenshot reporting on each failed should ● Screenshot API – – ● Providing screenshots' context Get all screenshots for context Actively supported by authors
  • 18. public static final Condition checked = new Condition("checked") { @Override public boolean apply(WebElement element) { return isChecked(element); } @Override public String actualValue(WebElement element) { return isChecked(element) ? "checked" : "unchecked"; } @Override public String toString(){ return "checked"; } };
  • 19. Or even shorter public static final Condition checked = new Condition("checked") { @Override public boolean apply(WebElement element) { return isChecked(element); } };
  • 22. Implementation public static final Condition checked = Condition.hasClass("checked"); public static final Condition enabled = Condition.hasNotClass("disabled"); public static final Condition expanded = Condition.attribute("area-expanded", "true");
  • 24. Usage: is public static void ensureExpanded(SelenideElement item){ if (item.is(not(expanded))){ } } expand(item);
  • 26. Implementation (1) public static final Condition inRadioMode(final String radioMode){ return new Condition("in radio mode: " + radioMode) { @Override public boolean apply(WebElement webElement) { boolean res = true; for(WebElement mode: Mode.modes(webElement)){ if (Mode.value(mode).equals(radioMode)){ res = res && mode.getAttribute("class").contains("active"); } else { res = res && ! } } } }; } return res; mode.getAttribute("class").contains("active");
  • 27. Implementation (2) public static final Condition faded = new Condition("faded with backdrop" ) { @Override public boolean apply(WebElement element) { return backDropFor(element).exists(); } };
  • 28. Implementation (3) public static Condition leftSliderPosition(final Integer position) { return new Condition("left slider position " + position) { @Override public boolean apply(WebElement webElement) { return getLeftSliderCurrentPosition(webElement).equals(position); } }; }
  • 30. Composition* * public static final will be omitted for simplicity
  • 31. Implementation Condition loadingDialog = condition(loadingDialog(), exist); Condition applyButtonDisabled = condition(primeBtn(), disabled); Condition cancelButtonDisabled = condition(scndBtn(), disabled); Condition processed = with_(no(Modal.dialog())); Condition loaded = and(processed, with_(no(loadingDialog)), with_(applyButtonDisabled)); Condition savedForSure = and(loaded, with_(saveSuccessMsg())); Condition failedToSave = and( processed, with_(no(loadingDialog)), with_(not(applyButtonDisabled)), with_(no(saveSuccessMsg())), with_(not(cancelButtonDisabled)), with_(saveErrorsMsg()));
  • 32. Usage //fill page with valid/invalid data... Page.save() Page.shouldBe(and( failedToSave, with(usernameValidation(), currentPassValidation()), with(no(newPassValidation(), matchPassValidation())))) //fix errors and save... Page.shouldBe(savedForSure)
  • 33. Selenide Cons ● Young:) – Many things can be improved ● Error messages ● Condition helpers ● Screenshot API – – ● Tones of them have been resolved so far Others can be implemented as your own extensions Not all-powerfull – For some things you will still need raw WebDriver
  • 34.
  • 35. Easyb Pros ● Gherkin (given/when/then) and its implementation live at the same file – better maintainability – more DRY code ● no implementation => “pending” test ● simple but nice looking reports ● groovy as a script language for tests – scenarios are ordered
  • 36. Easyb Cons ● bad support of framework from authors. ● some features are broken – ● no tags per scenario/step – ● ● ● before_each only tags per story Stack trace of error messages is clipped No out of the box way to put listeners on steps/scenarios “Shared steps” feature is present but not quite handy
  • 38. Problem Selenide shoulds vs Easyb shoulds Easyb catches any 'should' (shouldBe, shouldHave, ...) except “should” and “shouldNot” showPasswordCheckBox().shouldNot(checked); //Less readable:(
  • 41. Preconditions to BDD Team is competent :) ● ● PO knows what is Criteria of Good Requirement Manual QA knows how to write “Automatable” Scenarios
  • 42. Pending Easyb Story by PO description "Products List page" scenario "Add new product", { given "On Products List page" then "new product can be added" }
  • 43. Pending Detailed Easyb Story by Manual QA description "Products List page" scenario "Add new product", { given "On Products List page" and "No custom product with 'Product_1' name exist" then "new product with 'Product_1' name can be added" and "after relogin still present" }
  • 44. Implemented Easyb Story description "ProductsList test" tags "functional" BaseTest.setup() scenario "Add new product", { given "On ProductsList page",{ ProductsList.page().get() } and "No custom product with '" + TEST_PRODUCT + "' name exist", { Table.ensureHasNo(cellByText(TEST_PRODUCT)) } then "new product with '" + TEST_PRODUCT + "' name can be added", { ProductsList.addProductForSure(TEST_PRODUCT) } and "after relogin still present", { cleanReLogin() Table.cellByText(TEST_PRODUCT).should(be(visible)); } }
  • 47. Alternative: TestNG test public class ProductManagement extends AbstractTest { @Test public void testNewProductCanBeAdded() { ProductsList.page().get(); Table.ensureHasNo(cellByText(TEST_PRODUCT)); ProductsList.addProductForSure(TEST_PRODUCT); cleanReLogin(); Table.cellByText(TEST_PRODUCT).should(Be.visible); } }
  • 50. When Easyb ? ● “Somebody” wants Gherkin – Automation resources are limited, and help may come from PO or Manual QA providing detailed 'steps to code' ● Detailed reporting of test steps ● Ordered tests execution (as present in the file)
  • 51. When TestNG/Junit ? ● When you have strong 'agile' devs/automation which know why what and how to test and do write tests. – Hence you never need pretty looking reports to please your manager customer because you just have high quality product.
  • 52. Ideas for improvements ● Kill Kenny – if he is the only who wants Gherkin:) – and stay KISS with TestNG/Junit ● Contribute to Easyb:) ● Bless Selenide:) – Authors will contribute nevertheless
  • 53.
  • 54. Q&A
  • 55. Resources, Links ● ● ● Src of example test framework: https://github.com/yashaka/gribletest Application under test used in easyb examples: http://grible.org/download.php Instruments – http://selenide.org/ – http://easyb.org/
  • 56. ● To Artem Chernysh for implementation of main base part of the test framework for this presentation – ● To Maksym Barvinskyi for application under test – ● https://github.com/elaides/gribletest http://grible.org/ To Andrei Solntsev, creator of Selenide, for close collaboration on Selenide Q&A, and new features implemented:)