SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Fernando Sandes




How to
improve our
acceptance tests !
What is
     better?




Pyccuracy
         vs
It`s not (only)
   about
the technology
It`s an
ideologica
  difference
@gabrielfalcao
           Lettuce`s creator




The problem is that differently of
cucumber and lettuce, pyccuracy is
aimed to web testing, with pre-defined
"step definitions" (pyccuracy uses a
different nomenclature), and when I was
using it I found extremely hard to
maintain the tests as the test suite
grows, it's a hell!




                               lettuce
@gabrielfalcao
            Lettuce`s creator




“So I wrote lettuce to make it super flexible
so that I could write my own definitions in a super
easy way, and never couple my tests to robotic
step definitions.”



                                lettuce
Pyccuracy


    ROBOTIC
    STEP
  DEFINITIONS
ROBOTIC                              STEP        DEFINITIONS

Given I fill the field "#username" with "test"

And I fill the field "#password" with "1234"

When I click on the button 'input[type="submit"]'

Then I see the page contains the text "Hello Test User!"




                                                 Given I am at the login page

                                                 And I fill in the login information with "test" and password "1234"

                                                 When I click on the login button

                                                 Then I see I'm logged in as a normal user
ROBOTIC                              STEP        DEFINITIONS

Given I fill the field "#username" with "test"

And I fill the field "#password" with "1234"

When I click on the button 'input[type="submit"]'

Then I see the page contains the text "Hello Test User!"

                                                                        “You can see how your
                                                                        business it better defined here”



                                                 Given I am at the login page

                                                 And I fill in the login information with "test" and password "1234"

                                                 When I click on the login button

                                                 Then I see I'm logged in as a normal user
DONT`T BE
                           THE
                                           BOILING
                                           FROG               !
The presence of step definitions leads people down a very
bad path.
While it gives people a head start in writing scenarios it
also tricks people into writing scenarios are extremely
verbose and fragile.
People don't always realize this, so they continue cranking
out lots of crap scenarios based on pre-steps. This is like
the boiling frog story
IT`S ABOUT                      THE      DOMAIN !


 The “domain” is defined by the value
                             the stakeholders
 and users hope to achieve with the software.
 This can be booking a ticket or sharing pictures with friends or
 an infinite number of activities.


 Clicking links and buttons or filling in text fields has nothing
 (directly) to do with the domain.
Pyccuracy
IS BUROCRATIC !
a little more…
Imperative
         VS
           Declarative

            Scenarios in User Stories
The imperative style uses highly reusable

Imperative                                 granular steps which outlines
                                           user interface.
                                                                           much of the


                                           This binds the scenario to that interface.




Scenario: Successful login

Given a user "Aslak" with password "xyz"
And I am on the login page
And I fill in "User name" with "Aslak"
And I fill in "Password" with "xyz"
When I press "Log in"
Then I should see "Welcome, Aslak“
The imperative style uses highly reusable

Imperative                                 granular steps which outlines
                                           user interface.
                                                                            much of the


                                           This binds the scenario to that interface.




Scenario: Successful login                  Scenario: User is greeted upon login

Given a user "Aslak" with password "xyz"    Given the user "Aslak" has an account
And I am on the login page                  When he logs in
And I fill in "User name" with "Aslak"      Then he should see "Welcome, Aslak"
And I fill in "Password" with "xyz"
When I press "Log in"
Then I should see "Welcome, Aslak“




                                           Declarative
The imperative style uses highly reusable

Imperative                                 granular steps which outlines
                                           user interface.
                                                                            much of the


                                           This binds the scenario to that interface.




Scenario: Successful login                  Scenario: User is greeted upon login

Given a user "Aslak" with password "xyz"    Given the user "Aslak" has an account
And I am on the login page                  When he logs in
And I fill in "User name" with "Aslak"      Then he should see "Welcome, Aslak"
And I fill in "Password" with "xyz"
When I press "Log in"
Then I should see "Welcome, Aslak“




                                           Declarative
Imperative Declarative


When we’re describing other parts of the system that
require login, the login details like user name, password
and how to log in are only distracting. That is why
we make it a one-liner.
Imperative Declarative
Imperative Declarative
COMMUNICATION
                      IS THE
                                 GOAL!

  To use a BDD tool "right", one has to understand
  that the main goal is primarily about
  communication and secondarily
  about testing.
COMING BACK…


         And   about
         technology
SPLINTER
Splinter was not created to be another acceptance
tool, but an abstract   layer over other
tools,  its goal is provide a unique API that make
acceptance testing easier and funnier :)
SPLINTER

A LOT OF OPTIONS !
HEADLESS   OR NOT HEADLESS ?
HEADLESS



FAST

CHEAP

HARD TO DEBUG

IT`S NOT A BROWSER!
NOT HEADLESS



SLOW

EASY TO DEBUG

USE THE BROWSER
HEADLESS

NOT HEADLESS
 SPLINTER
SERVER




LOCAL
SERVER




        HEADLESS
LOCAL
NOT HEADLESS
                   SERVER




               HEADLESS
    LOCAL
SPLINTER
 and more…

http status code
multi webdrivers
css ,xpath, tag, name selectors
support to iframe and alert
execute javascript
work's with ajax and async javascript
SPLINTER
Browser

• visit(‘url’)
• reload()
• quit()
• html
• url
• title
SPLINTER
Searching elements


• find_by_css(‘.classe’)
• find_by_id(‘meuid’)
• find_by_xpath(‘//body’)
• find_by_tag(‘a’)
• find_by_name(‘search’)
SPLINTER
 Forms


• fill(‘name’, ‘value’)
• attach_file(‘name’, ‘/path/to/file.txt’)
• check(‘name’) #checkbox
• choose(‘name’, ‘value’) #radio button
• select(‘name’, ‘option’)
MORE


TESTS
SIKULI
         http://sikuli.org/index.shtml
NEEDLE
                   http://needle.readthedocs.org


                #AUTOMATED TESTS FOR CSS


  from needle.cases import NeedleTestCase


  class GoogleTest(NeedleTestCase):
    def test_footer(self):
      self.driver.get('http://www.google.com')
      e = self.driver.find_element_by_id('fctr')
      self.assertScreenshot(e, 'google-footer')
      self.assertEqual(e.get_computed_property('font-size'), '13px')

Weitere ähnliche Inhalte

Andere mochten auch

BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
John Ferguson Smart Limited
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testing
dversaci
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
Brandon Keepers
 

Andere mochten auch (10)

[RuPy 2011] Automatic Acceptance Tests in Ruby
[RuPy 2011] Automatic Acceptance Tests in Ruby[RuPy 2011] Automatic Acceptance Tests in Ruby
[RuPy 2011] Automatic Acceptance Tests in Ruby
 
End to End Testing: Bug Squashing for API Developers
End to End Testing: Bug Squashing for API Developers End to End Testing: Bug Squashing for API Developers
End to End Testing: Bug Squashing for API Developers
 
Rails testing: factories or fixtures?
Rails testing: factories or fixtures?Rails testing: factories or fixtures?
Rails testing: factories or fixtures?
 
Automated testing with RSpec
Automated testing with RSpecAutomated testing with RSpec
Automated testing with RSpec
 
Real-time hypermedia APIs: Exploring the fundamentals of how we build network...
Real-time hypermedia APIs: Exploring the fundamentals of how we build network...Real-time hypermedia APIs: Exploring the fundamentals of how we build network...
Real-time hypermedia APIs: Exploring the fundamentals of how we build network...
 
BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testing
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
 

Ähnlich wie How to improve our acceptance tests - Pyccuracy VS Splinter

Ähnlich wie How to improve our acceptance tests - Pyccuracy VS Splinter (20)

Enabling agile devliery through enabling BDD in PHP projects
Enabling agile devliery through enabling BDD in PHP projectsEnabling agile devliery through enabling BDD in PHP projects
Enabling agile devliery through enabling BDD in PHP projects
 
Write Tests in End Users’ Lingo
Write Tests in End Users’ LingoWrite Tests in End Users’ Lingo
Write Tests in End Users’ Lingo
 
Story-driven Testing
Story-driven TestingStory-driven Testing
Story-driven Testing
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot Overlords
 
I put on my mink and wizard behat (talk)
I put on my mink and wizard behat (talk)I put on my mink and wizard behat (talk)
I put on my mink and wizard behat (talk)
 
Transformando os pepinos do cliente no código de testes da sua aplicação
Transformando os pepinos do cliente no código de testes da sua aplicaçãoTransformando os pepinos do cliente no código de testes da sua aplicação
Transformando os pepinos do cliente no código de testes da sua aplicação
 
I put on my mink and wizard behat
I put on my mink and wizard behatI put on my mink and wizard behat
I put on my mink and wizard behat
 
Quick ref capybara
Quick ref capybaraQuick ref capybara
Quick ref capybara
 
Quick ref capybara
Quick ref capybaraQuick ref capybara
Quick ref capybara
 
Android testing calabash
Android testing calabashAndroid testing calabash
Android testing calabash
 
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
 
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
 
I put on my mink and wizard behat - Confoo Canada
I put on my mink and wizard behat - Confoo CanadaI put on my mink and wizard behat - Confoo Canada
I put on my mink and wizard behat - Confoo Canada
 
ITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven DevelopmentITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven Development
 
How React Native Appium and me made each other shine
How React Native Appium and me made each other shineHow React Native Appium and me made each other shine
How React Native Appium and me made each other shine
 
BDD - Collaborate like you mean it!
BDD - Collaborate like you mean it!BDD - Collaborate like you mean it!
BDD - Collaborate like you mean it!
 
Embracing Capybara
Embracing CapybaraEmbracing Capybara
Embracing Capybara
 
Largamos o Cucumber!
Largamos o Cucumber!Largamos o Cucumber!
Largamos o Cucumber!
 
Largamos o cucumber
Largamos o cucumberLargamos o cucumber
Largamos o cucumber
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

How to improve our acceptance tests - Pyccuracy VS Splinter

  • 1. Fernando Sandes How to improve our acceptance tests !
  • 2. What is better? Pyccuracy vs
  • 3.
  • 4. It`s not (only) about the technology
  • 5. It`s an ideologica difference
  • 6. @gabrielfalcao Lettuce`s creator The problem is that differently of cucumber and lettuce, pyccuracy is aimed to web testing, with pre-defined "step definitions" (pyccuracy uses a different nomenclature), and when I was using it I found extremely hard to maintain the tests as the test suite grows, it's a hell! lettuce
  • 7. @gabrielfalcao Lettuce`s creator “So I wrote lettuce to make it super flexible so that I could write my own definitions in a super easy way, and never couple my tests to robotic step definitions.” lettuce
  • 8. Pyccuracy ROBOTIC STEP DEFINITIONS
  • 9. ROBOTIC STEP DEFINITIONS Given I fill the field "#username" with "test" And I fill the field "#password" with "1234" When I click on the button 'input[type="submit"]' Then I see the page contains the text "Hello Test User!" Given I am at the login page And I fill in the login information with "test" and password "1234" When I click on the login button Then I see I'm logged in as a normal user
  • 10. ROBOTIC STEP DEFINITIONS Given I fill the field "#username" with "test" And I fill the field "#password" with "1234" When I click on the button 'input[type="submit"]' Then I see the page contains the text "Hello Test User!" “You can see how your business it better defined here” Given I am at the login page And I fill in the login information with "test" and password "1234" When I click on the login button Then I see I'm logged in as a normal user
  • 11. DONT`T BE THE BOILING FROG ! The presence of step definitions leads people down a very bad path. While it gives people a head start in writing scenarios it also tricks people into writing scenarios are extremely verbose and fragile. People don't always realize this, so they continue cranking out lots of crap scenarios based on pre-steps. This is like the boiling frog story
  • 12. IT`S ABOUT THE DOMAIN ! The “domain” is defined by the value the stakeholders and users hope to achieve with the software. This can be booking a ticket or sharing pictures with friends or an infinite number of activities. Clicking links and buttons or filling in text fields has nothing (directly) to do with the domain.
  • 15. Imperative VS Declarative Scenarios in User Stories
  • 16. The imperative style uses highly reusable Imperative granular steps which outlines user interface. much of the This binds the scenario to that interface. Scenario: Successful login Given a user "Aslak" with password "xyz" And I am on the login page And I fill in "User name" with "Aslak" And I fill in "Password" with "xyz" When I press "Log in" Then I should see "Welcome, Aslak“
  • 17. The imperative style uses highly reusable Imperative granular steps which outlines user interface. much of the This binds the scenario to that interface. Scenario: Successful login Scenario: User is greeted upon login Given a user "Aslak" with password "xyz" Given the user "Aslak" has an account And I am on the login page When he logs in And I fill in "User name" with "Aslak" Then he should see "Welcome, Aslak" And I fill in "Password" with "xyz" When I press "Log in" Then I should see "Welcome, Aslak“ Declarative
  • 18. The imperative style uses highly reusable Imperative granular steps which outlines user interface. much of the This binds the scenario to that interface. Scenario: Successful login Scenario: User is greeted upon login Given a user "Aslak" with password "xyz" Given the user "Aslak" has an account And I am on the login page When he logs in And I fill in "User name" with "Aslak" Then he should see "Welcome, Aslak" And I fill in "Password" with "xyz" When I press "Log in" Then I should see "Welcome, Aslak“ Declarative
  • 19. Imperative Declarative When we’re describing other parts of the system that require login, the login details like user name, password and how to log in are only distracting. That is why we make it a one-liner.
  • 22. COMMUNICATION IS THE GOAL! To use a BDD tool "right", one has to understand that the main goal is primarily about communication and secondarily about testing.
  • 23. COMING BACK… And about technology
  • 24. SPLINTER Splinter was not created to be another acceptance tool, but an abstract layer over other tools, its goal is provide a unique API that make acceptance testing easier and funnier :)
  • 25. SPLINTER A LOT OF OPTIONS !
  • 26. HEADLESS OR NOT HEADLESS ?
  • 28. NOT HEADLESS SLOW EASY TO DEBUG USE THE BROWSER
  • 31. SERVER HEADLESS LOCAL
  • 32. NOT HEADLESS SERVER HEADLESS LOCAL
  • 33. SPLINTER and more… http status code multi webdrivers css ,xpath, tag, name selectors support to iframe and alert execute javascript work's with ajax and async javascript
  • 34. SPLINTER Browser • visit(‘url’) • reload() • quit() • html • url • title
  • 35. SPLINTER Searching elements • find_by_css(‘.classe’) • find_by_id(‘meuid’) • find_by_xpath(‘//body’) • find_by_tag(‘a’) • find_by_name(‘search’)
  • 36. SPLINTER Forms • fill(‘name’, ‘value’) • attach_file(‘name’, ‘/path/to/file.txt’) • check(‘name’) #checkbox • choose(‘name’, ‘value’) #radio button • select(‘name’, ‘option’)
  • 38. SIKULI http://sikuli.org/index.shtml
  • 39. NEEDLE http://needle.readthedocs.org #AUTOMATED TESTS FOR CSS from needle.cases import NeedleTestCase class GoogleTest(NeedleTestCase): def test_footer(self): self.driver.get('http://www.google.com') e = self.driver.find_element_by_id('fctr') self.assertScreenshot(e, 'google-footer') self.assertEqual(e.get_computed_property('font-size'), '13px')