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

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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
 
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
 
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
 
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
 
🐬 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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 

Recently uploaded (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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...
 

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.