SlideShare a Scribd company logo
@yashaka 01.2017
easy_automation.py
Plan
Intro
Live Coding Session
Easy Automation Tools Retrospective
Q&A
Why Automation?
Testing
=
Assessing Quality
Effective Testing
=>
Assessing Quality
0
50
100
150
200
Automation
=
Automating manual routine work
Effective Testing
*=
Testing with automated routine
work
Automation!
But, it’s hard, no?
no:p
Coding Session
https://github.com/yashaka/talks/tree/master/easy-automation-py
Summary
Coverage Styles
End to End style
+ more coverage in
less time with less
efforts during
implementation
+ integration coverage
Unit/One-feature-per-test
style
+ in case of bugs, gives
more complete report
+ easier to identify reason
from the report
=>
+ less time and efforts in
support
How many => => Only:
+ functional
high priority
use cases
Avoid => => No
- style checks
- low priority test cases
(that user will not do
on regular basis)
- additional requirements,
like “different kind of names
for entities”
<=
Implementing Automation
• Project in progress, no Automation?
1. start with End To End style smoke integration
tests
2. review and test plan
3. cover with “One feature”/“Unit” style
independent tests
Implementing Automation
• Project just started and Auto-POC is approved OR
ready features are automated?
1. Test plan new features
2. Cover with “One feature”/“Unit” style
independent tests
3. Add End to End integration smoke tests
Wasn’t it Easy? :)
Of course, “Automation is Easy” is a semi-truth
but the devil is not so black as he is painted;)
How to start?
• Choose language
• Learn language (interactive tutorials, koans,
exercism.io/checkio.org, learnxinyminutes.com,
books, etc.)
• Choose Easy Tools
• Find a mentor (friend, dev on your project, chat,
etc…)
• Go :)
Choose language?
• Have project?
• choose language of project’s developers
• Have no project but want to find work fast?
• choose one of the most popular language
• Have no project but want to code in your style, and it
does not matter how long will you seek for the job?
• choose language that fits you
Learn language?
Google :p
interactive tutorials + koans + exercism.io +
docs.seleniumhq.org + google.com
=
“You can do this in any language.”
Easy Tools?
• Just a few examples…
• Python: Selene
• C#: NSelene
• Java: Selenide
• Ruby: Capybara
tasks = ss("#todo-list>li")



...
def toggle(task_text):



tasks.element_by(have.exact_text(task_text)).element(“.toggle”).click()





def should_be(*task_texts):



tasks.filtered_by(be.visible).should(have.exact_texts(*task_texts))
public class Tasks {



public static ElementsCollection tasks = $$("#todo-list>li");



...


public static void toggle(String taskText) {


tasks.findBy(exactText(taskText)).find(".toggle").click();

}



public static void shouldBe(String ... taskTexts) {


tasks.filterBy(visible).shouldHave(exactTexts(taskTexts));

}

}
public static class Tasks

{

public static SCollection List = SS("#todo-list>li"); 



...



public static void Toggle (string taskText)

{

List.FindBy(Have.ExactText(taskText)).Find(".toggle").Click();

}



public static void ShouldBe(params string [] names)
{

List.FilterBy(Be.Visible).Should(Have.Texts(names));

}

}
module Tasks

extend Capybara ::DSL



def self.tasks

all "#todo-list>li"

end


...

def self.toggle task_text


(tasks.findBy {|task| task.text == task_text}).find(".toggle").click

end



def self.should_be *task_texts


tasks.texts.should == task_texts

end

end
= ?Easy Tool
= ?Selene
= …
web automation tool
…
Selene
= …
web automation tool
selenium wrapper
Selene
= …
web automation tool
selenium wrapper
Selene
= Effective
web test automation tool
Selene
= Effective
web test automation tool
being also
selenium wrapper
Selene
= Effective
web test automation tool
=
?
Selene
= Effective
web test automation tool
=
tool to automate
web UI tests logic
Selene
= Effective
web test automation tool
=
tool to automate
web UI tests logic
not browser
Selene
= Effective
web test automation tool
=
tool to automate
web UI tests logic
not browser
(it should be already automated;)
Selene
= Effective
web test automation tool
=
tool to automate
web UI tests logic
not browser
Selene
concise API
…
…
…
…
= Effective
web test automation tool
=
tool to automate
web UI tests logic
not browser
Selene
concise API
waiting search
…
…
…
= Effective
web test automation tool
=
tool to automate
web UI tests logic
not browser
Selene
concise API
waiting search
waiting asserts
…
…
= Effective
web test automation tool
=
tool to automate
web UI tests logic
not browser
concise API
waiting search
waiting asserts
dynamic elements
…
Selene
= Effective
web test automation tool
=
tool to automate
web UI tests logic
not browser
Selene
concise API
waiting search
waiting asserts
dynamic elements
informative errors
Selene = Effective
web test automation tool
=
tool to automate
web UI tests logic
not browser
concise API
waiting search
waiting asserts
dynamic elements
informative errors
“UI Tests Logic” Automation with Selene
Easy automation.py
class TestTodoMVC(object):

def test_filter_active_tasks(self):



# visit page


# add "a"
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic


# visit page


# add "a"
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic


visit("https: //todomvc4tasj.herokuapp.com/")


# add "a"
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Concise API


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Automatic Driver Management


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Concise API
search element “short-cut”


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Concise API
default conversion to “by css” locator


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Concise API
with implicit clear()


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Concise API
chainable methods


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Dynamic Elements
search actually starts here


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
# add "b"
# add "c"

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Waiting Search
with implicit waiting for visibility


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
s("#new-todo").set("b").press_enter()
s("#new-todo").set("c").press_enter()

# tasks should be "a", "b", "c"



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
UI Tests Logic
Waiting Asserts
aka “explicit waits”


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
s("#new-todo").set("b").press_enter()
s("#new-todo").set("c").press_enter()

ss("#todo-list li").should(have.exact_texts("a", "b", "c"))



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
handy conditions
Waiting Asserts


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
s("#new-todo").set("b").press_enter()
s("#new-todo").set("c").press_enter()

ss("#todo-list li”).should(have.texts(“a", "b", "c"))



# toggle "b"



# filter active

# tasks should be "a", "c"


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
s("#new-todo").set("b").press_enter()
s("#new-todo").set("c").press_enter()

ss("#todo-list li”).should(have.texts("a.", "b.", "c."))



# toggle "b"



# filter active

# tasks should be "a", "c"
UI Tests Logic
Informative errors
E TimeoutException: Message:
E failed while waiting 4 seconds
E to assert ExactTexts
E for all_by('css selector', '#todo-list li')
E
E reason: ConditionMismatchException: condition did not match
E expected: ('a.', 'b.', 'c.')
E actual: ['a', 'b', 'c']
E screenshot: /Users/ayia/.selene/screenshots/1484695102265/screen_1484695102266.png
UI Tests Logic
instead of bulky xpath locators
inner element search
Concise API & Waiting Search


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
s("#new-todo").set("b").press_enter()
s("#new-todo").set("c").press_enter()

ss("#todo-list li”).should(have.texts("a", "b", "c"))



ss("#todo-list li”).element_by(have.text(“b")).element(".toggle").click()



# filter active

# tasks should be "a", "c"
laconic inner collection
search by text
UI Tests Logic
custom locators


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
s("#new-todo").set("b").press_enter()
s("#new-todo").set("c").press_enter()

ss("#todo-list li”).should(have.texts(“a", "b", "c"))



ss("#todo-list li”).element_by(have.text(“b")).element(".toggle").click()



s(by.link_text("Active")).click()

# tasks should be "a", "c"
UI Tests Logic
Concise API & Waiting Asserts
filtering collection


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
s("#new-todo").set("b").press_enter()
s("#new-todo").set("c").press_enter()

ss("#todo-list li”).should(have.texts(“a", "b", "c"))



ss("#todo-list li").element_by(have.text("b")).element(".toggle").click()



s(by.link_text("Active")).click()

tasks.filtered_by(be.visible).should(have.texts(“a”, "c"))
UI Tests Logic


visit("https: //todomvc4tasj.herokuapp.com/")


s("#new-todo").set("a").press_enter()
s("#new-todo").set("b").press_enter()
s("#new-todo").set("c").press_enter()

ss("#todo-list li").should_have(texts("a", "b", "c"))



ss("#todo-list li").element_by(have.text("b")).element(".toggle").click()



s(by.link_text("Active")).click()

tasks.filtered_by(be.visible).should(have.texts("a", "c"))
Page steps for even
more readable code?
#tasks.py
def visit():

tools.visit("https: //todomvc4tasj.herokuapp.com/")

def add(*task_texts):

for text in task_texts:
s("#new-todo").set(text).press_enter()



def filter_active():

s(by.link_text("Active")).click()



def filter_completed():

s(by.link_text("Completed")).click()
#tasks.py
tasks = ss("#todo-list>li")



...
def toggle(task_text):

tasks.element_by(have.text(task_text)).element(".toggle").click()





def should_be(*task_texts):

tasks.filtered_by(be.visible).should(have.texts(*task_texts))
tasks = ss("#todo-list>li")



...
Dynamic Elements
possible because search does not start here
in fact, ss creates “lazy elements proxy” aka “elements lazy finder”;)
class TestTodoMVC(object):



def test_filter_tasks(self):



tasks.visit()



tasks.add("a", "b", "c")

tasks.should_be("a", "b", "c")



tasks.toggle("b")



tasks.filter_active ()

tasks.should_be("a", "c")



tasks.filter_completed ()

tasks.should_be("b")
Customisation
config.browser_name = "chrome"
...
or
config.browser_name = Browser.CHROME
...
will use “firefox” by default
config.app_host = "http: //mydomain.com"
...
visit("/subpage")
s(“#new-todo”).should(be.enabled)
Default Timeouts Behaviour
will wait until 4 seconds
s(“#new-todo”).should(be.enabled, timeout=10)
Custom
or
config.timeout = 10
...
s(“#new-todo”).should(be.enabled)
No Tool for your language?
No Tool for your language?
• Have project?
• ask project’s developers to write it for you
• Have no project and lack of knowledge?
• switch to language that has easy tools :)
• Brave?
• implement it by your own ;)
Remember…
• Automation is NOT a separate Role
• Automation IS A TOOL for Test Engineer to do his
work effectively
Q&A
Thank you!
@yashaka 01.2017
github.com/automician
automician.com
seleniumcourses.com
yashaka @

More Related Content

PDF
Easy tests with Selenide and Easyb
PDF
Kiss PageObjects [01-2017]
PDF
Polyglot automation - QA Fest - 2015
PDF
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
PDF
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
PDF
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
PDF
Web ui tests examples with selenide, nselene, selene & capybara
PDF
You do not need automation engineer - Sqa Days - 2015 - EN
Easy tests with Selenide and Easyb
Kiss PageObjects [01-2017]
Polyglot automation - QA Fest - 2015
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
Web ui tests examples with selenide, nselene, selene & capybara
You do not need automation engineer - Sqa Days - 2015 - EN

What's hot (20)

PPTX
Better Page Object Handling with Loadable Component Pattern
PDF
Automation Abstractions: Page Objects and Beyond
PDF
Selenium - The page object pattern
PDF
KISS Automation.py
PDF
Lets make a better react form
PPT
Gems Of Selenium
PDF
Enhance react app with patterns - part 1: higher order component
PDF
Automated Testing in Angular Slides
PPTX
Selenium withnet
PDF
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
PDF
APIs: A Better Alternative to Page Objects
PDF
Use React Patterns to Build Large Scalable App
PDF
Page object pattern
PDF
Automation Abstraction Layers: Page Objects and Beyond
ZIP
Automated Frontend Testing
PDF
Test automation & Seleniun by oren rubin
PDF
My Test Automation Journey
PDF
Webdriver cheatsheets summary
PDF
Front-End Testing: Demystified
PDF
Page Objects Done Right - selenium conference 2014
Better Page Object Handling with Loadable Component Pattern
Automation Abstractions: Page Objects and Beyond
Selenium - The page object pattern
KISS Automation.py
Lets make a better react form
Gems Of Selenium
Enhance react app with patterns - part 1: higher order component
Automated Testing in Angular Slides
Selenium withnet
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
APIs: A Better Alternative to Page Objects
Use React Patterns to Build Large Scalable App
Page object pattern
Automation Abstraction Layers: Page Objects and Beyond
Automated Frontend Testing
Test automation & Seleniun by oren rubin
My Test Automation Journey
Webdriver cheatsheets summary
Front-End Testing: Demystified
Page Objects Done Right - selenium conference 2014
Ad

Viewers also liked (17)

PPTX
Write Selenide in Python 15 min
PPTX
Automation is Easy! (python version)
PPTX
Автотесты на уровне API для Java-приложений (SQA Days 14)
PPT
Самописный робот на Watin
PDF
Parasoft SOAtest
PPTX
QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...
DOC
Кадры для ИТ-индустрии: найти и удержать
PPTX
Appium + selenide comaqa.by. Антон Семенченко
PDF
В чем проблема?
PDF
Better Page Object Handling with Loadable Component Pattern
DOC
Развитие в тестировании: включаем реактивный двигатель!
PPTX
Test Automation Wargaming SQA Days 17
PDF
QA Fes 2016. Алексей Виноградов. Page Objects: лучше проще, да лучшe
PPTX
Web testing with Selenium
PDF
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
PDF
Continuous Testing Meets the Classroom at Code.org
PPTX
Selenium
Write Selenide in Python 15 min
Automation is Easy! (python version)
Автотесты на уровне API для Java-приложений (SQA Days 14)
Самописный робот на Watin
Parasoft SOAtest
QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...
Кадры для ИТ-индустрии: найти и удержать
Appium + selenide comaqa.by. Антон Семенченко
В чем проблема?
Better Page Object Handling with Loadable Component Pattern
Развитие в тестировании: включаем реактивный двигатель!
Test Automation Wargaming SQA Days 17
QA Fes 2016. Алексей Виноградов. Page Objects: лучше проще, да лучшe
Web testing with Selenium
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
Continuous Testing Meets the Classroom at Code.org
Selenium
Ad

Similar to Easy automation.py (20)

PDF
Tellurium.A.New.Approach.For.Web.Testing.V5
PDF
QA Fest 2015. Яков Крамаренко. Polyglot automation
PDF
Tellurium.A.New.Approach.For.Web.Testing
PPT
Qe conference milan_searchtestrobot
PPTX
Generative Testing in Clojure
PDF
Automated acceptance test
PPTX
Meaningful UI Test Automation
PPTX
Meaningful UI Test Automation
PDF
Java Test Automation for REST, Web and Mobile
PPTX
Test Automation
PDF
Best automation testing syllabus 2025.pdf
PPTX
Testing ASP.NET - Progressive.NET
PDF
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
PDF
Automated testing
PDF
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
PPT
Test strategy for web development
PDF
Real World Selenium
PDF
Selenium Basics
PPTX
Helpful Automation Techniques - Selenium Camp 2014
PDF
DaKiRY_BAQ2016_QADay_Яків Крамаренко "Автоматизація - це просто! (C#)"
Tellurium.A.New.Approach.For.Web.Testing.V5
QA Fest 2015. Яков Крамаренко. Polyglot automation
Tellurium.A.New.Approach.For.Web.Testing
Qe conference milan_searchtestrobot
Generative Testing in Clojure
Automated acceptance test
Meaningful UI Test Automation
Meaningful UI Test Automation
Java Test Automation for REST, Web and Mobile
Test Automation
Best automation testing syllabus 2025.pdf
Testing ASP.NET - Progressive.NET
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
Automated testing
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
Test strategy for web development
Real World Selenium
Selenium Basics
Helpful Automation Techniques - Selenium Camp 2014
DaKiRY_BAQ2016_QADay_Яків Крамаренко "Автоматизація - це просто! (C#)"

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
KodekX | Application Modernization Development
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
cuic standard and advanced reporting.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Review of recent advances in non-invasive hemoglobin estimation
Unlocking AI with Model Context Protocol (MCP)
Understanding_Digital_Forensics_Presentation.pptx
KodekX | Application Modernization Development
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
Chapter 3 Spatial Domain Image Processing.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectral efficient network and resource selection model in 5G networks
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
cuic standard and advanced reporting.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Monthly Chronicles - July 2025

Easy automation.py