SlideShare a Scribd company logo
1 of 86
Fluent
Lenium
Another way of using Selenium in
Java
Mathilde Lemée
Terracotta QA Engineer
DuchessFR Founder
Mobile dev – Aetys.fr
Java developper
FluentLenium
GREAT
tool
Ruby
APIS
Python
Java
.NET
Perl
PHP
GEB
WebDriver
Groovy
Jquery
Page object
Browser.drive {
go "http://google.com/ncr"
assert title == "Google”
$("input", name: "q").value("wikipedia”)
waitFor { title.endsWith("Google Search") }
def firstLink = $("li.g", 0).find("a.l")
assert firstLink.text() == "Wikipedia"
firstLink.click()
waitFor { title == "Wikipedia" }
Capybara
Ruby
Selenium
Webkit
Ruby drivers
Automatically waits
def login!
within("//form[@id='session']") do
fill_in 'Login', :with =>
'user@example.com'
fill_in 'Password', :with => 'password'
end
click_link 'Sign in'
end
Java
Javascript
jQuery
CSS
Fluent
Lenium
find(“a”)
find(“#id”)
find(“.myClass”)
TARGET
find(".small",
withName("foo"))
FILTER
find(".small",
withClass("foo"))
FILTER
find(".small",
withId("foo"))
FILTER
find(".small",
withText("foo"))
FILTER
find(".small",
withAttribute(”at”)
.equalTo(”foo”))
FILTER
find(".small", withId().
contains(”foo”))
FILTER
find(".small", withId().
containsWord(”foo”))
FILTER
find(".small", withId().
startsWith(”foo”))
FILTER
find(".small", withId().
endsWith(”foo”))
FILTER
find(".small",
withId().contains(
Pattern.compile
("abc*")))
FILTER
find(".small", withName("foo"))
find(".small” ).first()
FINDfind(".small")
find(".small", withName().
startsWith(”my")
ACCESS
find(".small").getNames()
ACCESS
find(".small").getIds()
ACCESS
find(".small").getValues()
ACCESS
find(".small").getTexts()
ACCESS
find(".small").
getAttributes(”custom")
ACCESS
find(".small").
getText()
ACCESS
find(".small").
html()
ACTIONS
goTo(“http://www.google.fr”)
click("#create-button")
doubleClick("#create-button")
FILL
fill("input").with("m
yLogin","myPassw
ord")
fill("#name").with("Mathilde")
find("#name").text("Mathilde")
fill("input:not([type='checkbox'])").with("tomato")
fill("input", with("type", notContains("checkbox"))).with("t
omato")
FORM
submit(“#myForm”)
clear("#myForm")
fill(“#name”).with(“Mathilde”)
ASSERTIONS
Your own
assertThat(title()).contains("Hello ");
assertThat(find(myCssSelecto2)).ha
sSize().lessThan(5);
public class BingTest extends FluentTest {
@Test
public void title_should_contain_query() {
goTo("http://www.bing.com");
fill("#sb_form_q").with("FluentLenium");
submit("#sb_form_go");
assertThat(title())
.contains("FluentLenium");
}
}
Example 1
PAGE
OBJECT
PATTERN
Why ?
Readable
Maintenable
Separate
concerns
How?
No assertions
Services
Hide internals
of the page
FluentPage
isAt
methods
getUrl
public class LoginPage extends FluentPage {
public String getUrl() {
return "myCustomUrl";
}
public void isAt() {
assertThat(title()).isEqualTo("MyTitle");
}
public void fillAndSubmitForm(String... paramsOrdered) {
fill("input").with(paramsOrdered);
click("#create-button");
}
}
@Page
LoginPage loginPage;
public void checkLoginFailed() {
goTo(loginPage);
loginPage.
fillAndSubmitLoginForm("login", ”wp");
assertThat(find(".error")).hasSize(1);
loginPage.isAt();
}
public class LoginPage extends FluentPage {
FluentWebElement createButton;
public String getUrl() {
return "myCustomUrl";
}
public void isAt() {
assertThat(title()).isEqualTo("MyTitle");
}
public void fillAndSubmitForm(String... paramsOrdered) {
fill("input").with(paramsOrdered);
createButton.click();
}
}
AWAIT
withDefaultSearchWait(long l, TimeUnit
timeUnit);
withDefaultPageWait(long l, TimeUnit
timeUnit);
isPresent()
await().
atMost(5,SECONDS).
until(".small").
await().
atMost(5,SECONDS).
until(".small").
hasName("name");
await().
atMost(5,SECONDS).
until(".small").
hasText(”text");
await().
atMost(5,SECONDS).
until(".small").containsText(”txt");
await().
atMost(5,SECONDS).
until(".small").
hasId("id");
await().
atMost(5,SECONDS).
until(".small").
hasSize(3);
await().
atMost(5,SECONDS).
until(".small").
hasSize().
greatherThan(3);
await().
atMost(5,SECONDS).
until(".small").
withText("myText").areDis
played();
await().
atMost(5,SECONDS).
until(".small").
withId("#id").
areEnabled();
await().
atMost(5,SECONDS).
until(".small").
with(”attribute").
startsWith(”xyz")
isPresent();
await().
atMost(5,SECONDS).
untilPage()
isLoaded();
await().
atMost(5,SECONDS).
untilPage()
isLoaded();
public class LoginPage extends
FluentPage {
@AjaxElement
FluentWebElement ajaxElem;
}
Page Object
public class LoginPage extends
FluentPage {
@AjaxElement(timeoutOnSeconds=3)
FluentWebElement ajaxElem;
}
PAGE OBJECT
And more …
Javascript
Screenshot
Direct access
Isolated tests
= new IsolatedTest().
goTo(DEFAULT_URL).
await().
atMost(1, SECONDS).
until(".small").
with("name").equalTo("name").
isPresent().
find("input").
first().
isEnabled();
Isolated tests
= new IsolatedTest(myDriver).
goTo(DEFAULT_URL).
await().
atMost(1, SECONDS).
until(".small").
with("name").equalTo("name").
isPresent().
find("input").
first().
isEnabled();
1 Browser /
Test
Slow
Really !
@SharedDriver
ONCE
PER_CLASS
PER_METHOD
ONCE
Test A – Method A => D1
Test A – Method B => D1
Test B – Method A => D1
PER_CLASS
Test A – Method A => D1
Test A – Method B => D1
Test B – Method A => D2
PER_METHOD
Test A – Method A => D1
Test A – Method B => D2
Test B – Method A => D3
CUCUMBER
Plain text
Automated
BDD
Scenario: Search by topic
Given there are 240 courses which do not
have the topic "biology"
And there are 2 courses A001, B205 that
each have "biology" as one of the topics
When I search for "biology"
Then I should see the following courses:
| Course code |
| A001 |
| B205 |
Feature: basic test
Scenario: scenario 1
Given feature I am on the first page
When feature I click on next page
Then feature I am on the second page
@Given(value = "feature I am o
the first page")
public void step1() {
this.initFluent();
this.initTest();
goTo(page);
}
@When(value = "feature I
click on next page")
public void step2() {
this.initFluent();
this.initTest();
click(“a#linkToPage2"
);
}
@Then(value = "feature I am on
the second page")
public void step3() {
this.initFluent();
this.initTest();
page2.isAt();
}
#1. Do not use
Selenium IDE
#2. World > XPath
#3. Use the Page
Object pattern
#4. Separate data
and test logic
#5. One test, one
assert
#6. Test code as
clean as functionnal
code
#7. Think //
#8. Build atomic
tests
#9. Do not be
limitated by the UI
#10. Industrialize
your tests
#11. Think
incremental
#12. A story of trust
Thank you !
fluentlenium.org
@MathildeLemee

More Related Content

What's hot

watir-webdriver
watir-webdriverwatir-webdriver
watir-webdriverjariba
 
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
 
Tips and tricks for building api heavy ruby on rails applications
Tips and tricks for building api heavy ruby on rails applicationsTips and tricks for building api heavy ruby on rails applications
Tips and tricks for building api heavy ruby on rails applicationsTim Cull
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksAddy Osmani
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009Ralph Whitbeck
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSHannes Hapke
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionPaul Irish
 
Solving Real World Problems with YUI 3: AutoComplete
Solving Real World Problems with YUI 3: AutoCompleteSolving Real World Problems with YUI 3: AutoComplete
Solving Real World Problems with YUI 3: AutoCompleteIsaacSchlueter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
En story of cakephp2.0
En story of cakephp2.0En story of cakephp2.0
En story of cakephp2.0Hiroki Shimizu
 
Restful App Engine
Restful App EngineRestful App Engine
Restful App EngineRyan Morlok
 

What's hot (20)

watir-webdriver
watir-webdriverwatir-webdriver
watir-webdriver
 
J query module1
J query module1J query module1
J query module1
 
Django
DjangoDjango
Django
 
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...
 
Tips and tricks for building api heavy ruby on rails applications
Tips and tricks for building api heavy ruby on rails applicationsTips and tricks for building api heavy ruby on rails applications
Tips and tricks for building api heavy ruby on rails applications
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
 
Watir web automated tests
Watir web automated testsWatir web automated tests
Watir web automated tests
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJS
 
Easy automation.py
Easy automation.pyEasy automation.py
Easy automation.py
 
jQuery UI and Plugins
jQuery UI and PluginsjQuery UI and Plugins
jQuery UI and Plugins
 
KISS Automation.py
KISS Automation.pyKISS Automation.py
KISS Automation.py
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
 
Selenium bootcamp slides
Selenium bootcamp slides   Selenium bootcamp slides
Selenium bootcamp slides
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Solving Real World Problems with YUI 3: AutoComplete
Solving Real World Problems with YUI 3: AutoCompleteSolving Real World Problems with YUI 3: AutoComplete
Solving Real World Problems with YUI 3: AutoComplete
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
En story of cakephp2.0
En story of cakephp2.0En story of cakephp2.0
En story of cakephp2.0
 
Restful App Engine
Restful App EngineRestful App Engine
Restful App Engine
 

Viewers also liked

テスト自動化の様々な道具を使ってみた四方山話
テスト自動化の様々な道具を使ってみた四方山話テスト自動化の様々な道具を使ってみた四方山話
テスト自動化の様々な道具を使ってみた四方山話haljik Seiji
 
Sikuli x 知っていますか?
Sikuli x 知っていますか?Sikuli x 知っていますか?
Sikuli x 知っていますか?Masuo Ohara
 
Fluentlenium Functional tests hang.pdf
Fluentlenium Functional tests hang.pdfFluentlenium Functional tests hang.pdf
Fluentlenium Functional tests hang.pdfplutoone TestTwo
 
5 steps for successful automation with Hiptest
5 steps for  successful automation with Hiptest5 steps for  successful automation with Hiptest
5 steps for successful automation with HiptestCommunity Manager @Hiptest
 
「自動家(オートメータ)をつくる」-システムテスト自動化カンファレンス2014 「.reviewrc」枠発表-
「自動家(オートメータ)をつくる」-システムテスト自動化カンファレンス2014 「.reviewrc」枠発表-「自動家(オートメータ)をつくる」-システムテスト自動化カンファレンス2014 「.reviewrc」枠発表-
「自動家(オートメータ)をつくる」-システムテスト自動化カンファレンス2014 「.reviewrc」枠発表-Kazuhito Miura
 
海外のSeleniumカンファレンスではどんな発表がされているのか2014
海外のSeleniumカンファレンスではどんな発表がされているのか2014海外のSeleniumカンファレンスではどんな発表がされているのか2014
海外のSeleniumカンファレンスではどんな発表がされているのか2014Nozomi Ito
 
Seleniumをもっと知るための本の話
Seleniumをもっと知るための本の話Seleniumをもっと知るための本の話
Seleniumをもっと知るための本の話Ryuji Tamagawa
 
脱・独自改造! GebでWebDriverをもっとシンプルに
脱・独自改造! GebでWebDriverをもっとシンプルに脱・独自改造! GebでWebDriverをもっとシンプルに
脱・独自改造! GebでWebDriverをもっとシンプルにHiroko Tamagawa
 
20141018 selenium appium_cookpad
20141018 selenium appium_cookpad20141018 selenium appium_cookpad
20141018 selenium appium_cookpadKazuaki Matsuo
 

Viewers also liked (10)

テスト自動化の様々な道具を使ってみた四方山話
テスト自動化の様々な道具を使ってみた四方山話テスト自動化の様々な道具を使ってみた四方山話
テスト自動化の様々な道具を使ってみた四方山話
 
FluentLenium
FluentLeniumFluentLenium
FluentLenium
 
Sikuli x 知っていますか?
Sikuli x 知っていますか?Sikuli x 知っていますか?
Sikuli x 知っていますか?
 
Fluentlenium Functional tests hang.pdf
Fluentlenium Functional tests hang.pdfFluentlenium Functional tests hang.pdf
Fluentlenium Functional tests hang.pdf
 
5 steps for successful automation with Hiptest
5 steps for  successful automation with Hiptest5 steps for  successful automation with Hiptest
5 steps for successful automation with Hiptest
 
「自動家(オートメータ)をつくる」-システムテスト自動化カンファレンス2014 「.reviewrc」枠発表-
「自動家(オートメータ)をつくる」-システムテスト自動化カンファレンス2014 「.reviewrc」枠発表-「自動家(オートメータ)をつくる」-システムテスト自動化カンファレンス2014 「.reviewrc」枠発表-
「自動家(オートメータ)をつくる」-システムテスト自動化カンファレンス2014 「.reviewrc」枠発表-
 
海外のSeleniumカンファレンスではどんな発表がされているのか2014
海外のSeleniumカンファレンスではどんな発表がされているのか2014海外のSeleniumカンファレンスではどんな発表がされているのか2014
海外のSeleniumカンファレンスではどんな発表がされているのか2014
 
Seleniumをもっと知るための本の話
Seleniumをもっと知るための本の話Seleniumをもっと知るための本の話
Seleniumをもっと知るための本の話
 
脱・独自改造! GebでWebDriverをもっとシンプルに
脱・独自改造! GebでWebDriverをもっとシンプルに脱・独自改造! GebでWebDriverをもっとシンプルに
脱・独自改造! GebでWebDriverをもっとシンプルに
 
20141018 selenium appium_cookpad
20141018 selenium appium_cookpad20141018 selenium appium_cookpad
20141018 selenium appium_cookpad
 

Similar to Fluentlenium

Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Marakana Inc.
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6Marakana Inc.
 
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingBDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingJohn Ferguson Smart Limited
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objectsRobert Bossek
 
Test driven development with behat and silex
Test driven development with behat and silexTest driven development with behat and silex
Test driven development with behat and silexDionyshs Tsoumas
 
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelComprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelvodQA
 
Automating Django Functional Tests Using Selenium on Cloud
Automating Django Functional Tests Using Selenium on CloudAutomating Django Functional Tests Using Selenium on Cloud
Automating Django Functional Tests Using Selenium on CloudJonghyun Park
 
Test automation with selenide
Test automation with selenideTest automation with selenide
Test automation with selenideIsuru Madanayaka
 
Let's read code: python-requests library
Let's read code: python-requests libraryLet's read code: python-requests library
Let's read code: python-requests librarySusan Tan
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jqueryKostas Mavridis
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue AdventureAllegient
 

Similar to Fluentlenium (20)

Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6
 
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingBDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objects
 
Test driven development with behat and silex
Test driven development with behat and silexTest driven development with behat and silex
Test driven development with behat and silex
 
behat
behatbehat
behat
 
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelComprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
 
Jquery
JqueryJquery
Jquery
 
Jquery
JqueryJquery
Jquery
 
Automating Django Functional Tests Using Selenium on Cloud
Automating Django Functional Tests Using Selenium on CloudAutomating Django Functional Tests Using Selenium on Cloud
Automating Django Functional Tests Using Selenium on Cloud
 
Test automation with selenide
Test automation with selenideTest automation with selenide
Test automation with selenide
 
J query training
J query trainingJ query training
J query training
 
Let's read code: python-requests library
Let's read code: python-requests libraryLet's read code: python-requests library
Let's read code: python-requests library
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
bcgr3-jquery
bcgr3-jquerybcgr3-jquery
bcgr3-jquery
 
bcgr3-jquery
bcgr3-jquerybcgr3-jquery
bcgr3-jquery
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue Adventure
 

More from MathildeLemee

More from MathildeLemee (7)

Prez imdg
Prez imdgPrez imdg
Prez imdg
 
Cache
CacheCache
Cache
 
Exploratoire
ExploratoireExploratoire
Exploratoire
 
Le Cache - Principes avancés - Devoxx
Le Cache - Principes avancés - DevoxxLe Cache - Principes avancés - Devoxx
Le Cache - Principes avancés - Devoxx
 
Byteman
BytemanByteman
Byteman
 
Selenium, testNG , Selenium Grid & Best Practices
Selenium, testNG , Selenium Grid & Best PracticesSelenium, testNG , Selenium Grid & Best Practices
Selenium, testNG , Selenium Grid & Best Practices
 
Indépendance
IndépendanceIndépendance
Indépendance
 

Recently uploaded

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

Fluentlenium

Editor's Notes

  1. Hello, Thanks for coming.My name is Mathilde Lemee, I’m a java developper.I’m a QA Engineer for terracotta, a company specialized in in-memory caching and scaling. I’m also a Java User Group founder in France, one that focus women in Java and I do some mobile developpement on iPhone and Android - some kid apps to help children learning. Today we will talk about a fluent wrapper in top of the Java API, FluentLenium.
  2. , I suppose that every body already know that selenium, stop me if it’s not the case. So Selenium is a great tool for testing UI, it’s open-source, stable, it supports a lot of browsers.Selenium WebDriver brings us a lot of new features, it’s now really much faster than before with selenium RCYou also have no need to run a separate server except on special cases (if you want to use Selenium Grid).Gone are wait_for_page_to_load(), wait_for_element_present(), etc. All element interactions, clicks, etc. are blocking now, which is good. We also have some tool to use the Page object Pattern, that is a pattern that everybody should really know.
  3. Another thing is that Seleniumis also available in a lot of langages. Let’s do a small poll. How many of you are using the Selenium .NET API ? Python ? Ruby ? Java ? Perl ? PHP ? Another one ?So that’s pretty cool. But as a Java user, sometimes, the JAVA api is not enough. The way to deal with AJAX stuff for example, the API don’t really fit my need so I try to look about other API than just the java API. The first I found was Geb.
  4. The first is GEB. GEB is a groovy wrapper around Selenium API.It brings together the power of WebDriver, the elegance of jQuery content selection, the robustness of Page Object modelling and the expressiveness of the Groovy language.It can be used for scripting, scraping and general automation — or equally as a functional/web/acceptance testing solution via integration with testing frameworks such asSpock, JUnit & TestNG.
  5. Browser.drive {    go "http://google.com/ncr"    assert title == "Google”    $("input", name: "q").value("wikipedia”)     waitFor { title.endsWith("Google Search") }deffirstLink = $("li.g", 0).find("a.l")    assertfirstLink.text() == "Wikipedia”    firstLink.click()    waitFor { title == "Wikipedia" }
  6. The second lib I found after GEB was, Capybara is a ruby library. It can talk with many different drivers which execute your tests through the same clean and simple interface. You can seamlessly choose between Selenium, Webkit or pure Ruby drivers.Tackle the asynchronous web with Capybara's powerful synchronization features. Capybara automatically waits for your content to appear on the page, you never have to issue any manual sleeps.
  7. def login!    within("//form[@id='session']")do      fill_in'Login', :with=>'user@example.com'      fill_in'Password', :with=>'password'    end    click_link'Sign in'  end
  8. So with all of that, I try to look about what we have and what the teams I work in needed. First thing is Java. We are Java developpers and for some reason we cannot switch the langage we use. We also are front dev so javascript is something we also manipulate a lot. And with Javascript come JQUEry. And with Jquery, also CSS, because jquery use a css like syntax for selecting the elements. So we put all of that in a shaker, shake a little bit and FluentLenium is born.
  9. So we put all of that in a shaker, shake a little bit and FluentLenium is born.
  10. As we discuss, most of the java/javascriptdev are fluent with the css syntax because it’s really easy to understand, rules are clear and you can do most of the stuff you want. So to target a element in the dom, just use find with the css selector. Just a remember on CSS, # means the element that have the id.“a” means the balise (traduction) so all link in the page.myClassneabs the elements that have the class myClass
  11. But because every people has a good level in css, we offer a fluent API to filter the dom elements. For exemple,, here, you select all the DOM element that havethe class small and the name foo
  12. So, we know how we can have access to the dom element.
  13. So, we know how we can have access to the dom element.
  14. So, we know how we can have access to the dom element.
  15. So, we know how we can have access to the dom element.
  16. So, we know how we can have access to the dom element.
  17. So, we know how we can have access to the dom element.
  18. If you use the singular (getText instead of getTexts), it will automaticall take the text of the first element on the list.So you have getText but also getName, getId, getValue, getAtribute…
  19. If you use the singular (getText instead of getTexts), it will automaticall take the text of the first element on the list
  20. But now, how can we interact with the elements ?
  21. ill("input").with("bar") or find("input").text("bar") will fill all the input elements with bar. If you want for example to exclude checkboxes, you can use the css filtering like fill("input:not([type='checkbox'])").with("tomato"), you can also use the filtering provided by FluentLenium fill("input", with("type", notContains("checkbox"))).with("tomato")fill("input").with("myLogin","myPassword") will fill the first element of the input selection with myLogin, the second with myPassword. If there are more input elements found, the last value (myPassword) will be repeated for each subsequent element.Don't forget, only visible fields will be modified. It simulates a real person using a browser!
  22. So now, we know the basics of the API, how we use another browser but that will not help us to write readable tests. Writing readable tests should always be in our mind when we are writing tests, no matter the tests. Because you can have a the better API in the world, if your test look like that => Clique suivant
  23. , you will have some troubles in the near future. So let’s go back with our Page Object Pattern.
  24. Selenium tests can easily become a mess. To avoid this, you can use the Page Object Pattern. Page Object Pattern will enclose all the plumbing relating to how pages interact with each other and how the user interacts with the page, which makes tests a lot easier to read and to maintain.It will really help you to have tests that are readable and maintenable.Try to construct your Page thinking that it is better if you offer services from your page rather than just the internals of the page. A Page Object can model the whole page or just a part of it.
  25.  It's simplest to think of the methods on a Page Object as offering the "services" that a page offers rather than exposing the details and mechanics of the page. Usually, a page object should not have any assertions on it. In fact, it’s hiding the internals of the page (like the id of the dom element, the dom interactions).
  26. To construct a Page, extend org.fluentlenium.core.FluentPage. In most cases, you have to define the url of the page by overriding the getUrl method. By doing this, you can then use the goTo(myPage) method in your test code.It may be necessary to ensure that you are on the right page, not just at the url returned by getUrl. To do this, override the isAt method to run all the assertions necessary in order to ensure that you are on the right page. For example, if I choose that the title will be sufficient to know if I'm on the right page:
  27. Create your own methods to easily fill out forms, go to another or whatever else may be needed in your test.
  28. And that’s the corresponding test.
  29. But it can be simpler. Within a page, all FluentWebElement fields are automatically searched for by name or id. For example, if you declare a FluentWebElement named createButton, it will search the page for an element where id is createButton or name is createButton. All elements are proxified which means that the search is not done until you try to access the element.
  30. So now, that we know how to create test using the page object pattern, change the browser and manipulate the dom using the API, we should speak about AJAX call. Because asynchronous call is something really common. Your first option is to defined global timeout. The first one withDefaultSearchWait will define the max time used to search for an element in the page (equivalent of driver.manage().timeouts().implicitWait(). The second, withDefaultPageWait, will defined the maximum time for a page to be loaded.But even if defined global timeout can fix a timeout problem, sometimes, we need to be more precise.
  31. 'greaterThan(int)', 'lessThan(int)', 'lessThanOrEqualTo(int)', 'greaterThanOrEqualTo(int)' , 'equalTo(int)', 'notEqualTo(int)'
  32. startsWith, notStartsWith, endsWith, notEndsWith, contains,notContains, equalTo, containsWord.And you can also define the polling if needed with pollingEvery.
  33. startsWith, notStartsWith, endsWith, notEndsWith, contains,notContains, equalTo, containsWord.And you can also define the polling if needed with pollingEvery.
  34. startsWith, notStartsWith, endsWith, notEndsWith, contains,notContains, equalTo, containsWord.And you can also define the polling if needed with pollingEvery.
  35. So what’s about the page object pattern ? Because everything is made to
  36. You can set the timeout in seconds for the page to throw an error if not found with@AjaxElement(timeountOnSeconds=3) if you want to wait 3 seconds. By default, the timeout is set to one second.
  37. And you have a lot of other features, you can of course execute some javascript using the executeJavascript method, take screenshot when you want or when a test fail with jUnit for example, and something really important for us : you ALWAYS have access to the selenium driver, so we guarantee that everything you do with that driver, you will be able to do inside FluentLenium
  38. We also have the isolated test, where tests are isolated. They do not depends on a FluentTest, you can embed everywhere.
  39. You can also give as a parameter a driver, which is a way (there are a lot) to play the same tests with differents browsers.
  40. At the beginning, one browser will be launch by test. It’s a godd way to avoid unexpected collisions between the test but because of that, it was
  41. Now Use the class annotation @SharedDriver and you will be able to defined how the driver will be created :@SharedDriver(type = SharedDriver.SharedType.ONCE)will allow you to use the same driver for every test annotate with that annotation (it can also be on a parent class) for all classes and methods.@SharedDriver(type = SharedDriver.SharedType.PER_CLASS)will allow you to use the same driver for every test annotate with that annotation (it can also be on a parent class) for all methods on a same class.@SharedDriver(type = SharedDriver.SharedType.PER_METHOD)will allow you to create a new driver for each method.
  42. Now Use the class annotation @SharedDriver and you will be able to defined how the driver will be created :@SharedDriver(type = SharedDriver.SharedType.ONCE)will allow you to use the same driver for every test annotate with that annotation (it can also be on a parent class) for all classes and methods.@SharedDriver(type = SharedDriver.SharedType.PER_CLASS)will allow you to use the same driver for every test annotate with that annotation (it can also be on a parent class) for all methods on a same class.@SharedDriver(type = SharedDriver.SharedType.PER_METHOD)will allow you to create a new driver for each method.
  43. Now Use the class annotation @SharedDriver and you will be able to defined how the driver will be created :@SharedDriver(type = SharedDriver.SharedType.ONCE)will allow you to use the same driver for every test annotate with that annotation (it can also be on a parent class) for all classes and methods.@SharedDriver(type = SharedDriver.SharedType.PER_CLASS)will allow you to use the same driver for every test annotate with that annotation (it can also be on a parent class) for all methods on a same class.@SharedDriver(type = SharedDriver.SharedType.PER_METHOD)will allow you to create a new driver for each method.
  44. Now Use the class annotation @SharedDriver and you will be able to defined how the driver will be created :@SharedDriver(type = SharedDriver.SharedType.ONCE)will allow you to use the same driver for every test annotate with that annotation (it can also be on a parent class) for all classes and methods.@SharedDriver(type = SharedDriver.SharedType.PER_CLASS)will allow you to use the same driver for every test annotate with that annotation (it can also be on a parent class) for all methods on a same class.@SharedDriver(type = SharedDriver.SharedType.PER_METHOD)will allow you to create a new driver for each method.
  45. Cucumber is a tool that executes plain-text functional descriptions as automated tests. While Cucumber can be thought of as a “testing” tool, the intent of the tool is to support BDD. This means that the “tests” (plain text feature descriptions with scenarios) are typically written before anything else and verified by business analysts, domain experts, etc. non technical stakeholders.
  46. So the non technical people will be able to write a lot of tests like this. You will have to defined what we call the “step” to make the bridge between the plain text line and the action.