SlideShare a Scribd company logo
1 of 9
Download to read offline
file:///Funittest.html




         Acceptance Testing for Plone
         Using Funittest
         Plone Conference 2007

         Maik Röder

         Yaco Sistemas

         maikroeder@gmail.com


         Acceptance Testing
              Agile software development methodology
              Extreme Programming
              Functional testing of a user story during the implementation phase
              Black box system tests
              Regression tests prior to a production release.


         Requirements
         Or, what I expect from a functional testing system

              Use case centered
              High level
              Readability
              Reusability
              Extensibility
              Modularization
              Simple elegance


         Acceptance Testing for Plone with
         Funittest
              Write acceptance test first
                    Test driven development
              Guarantee the quality of your Plone sites
                    Untested sites are broken sites
              Run in-browser acceptance tests
                    Selenium Remote Control


1 of 9                                                                                  12/10/07 16:53
file:///Funittest.html


                Real TestBrowser
           Extensive library of reusable scripts, verbs, scenarios and tests


         History
           Selenium
           PloneSelenium
           PLIP #100: Integrate Selenium for functional testing
           Funittest
           Funittest sprint


         Development with Funittest
           Documentation driven development
           Start with the Use Cases
                 Tell a story of what the user does step by step
           Write new use case scenarios or extensions
                 Developers may find documentation and think about other extensions
           Write high-level, domain-specific, vocabulary for each new user action
           Write new low level methods for vocabulary
           Write new functional tests reusing the scenarios
           Write new verification code outside of tests


         Presets
           Prepare a site for tests
           Add sample users to the site for testing
           Make changes to the site settings to facilitate testing
           Presets for Plone 3 and Plone 2.5 exist
           Simple Python file with a preset method
           Presets are run against a Plone site to make it establish data providers

                  def preset():

                  load_funittest_model(quot;funittest.lib.plone301.cmfplonequot;)

                  interpreter.setBrowserURL(quot;http://localhost:8080/Plonequot;)
                      dataprovider.cmfplone.user.current = ['admin',
                  'samplemanager', 'samplemember']
                      return [dataprovider.cmfplone.user]



         Custom presets

2 of 9                                                                                     12/10/07 16:53
file:///Funittest.html


           Each of your Plone projects should have a custom preset
           Have a look at the example Custom preset for implementing your own
           Run a preset against your Plone site:

                    python preset.py --preset myproject

           Plone site is ready for testing
           Does not (yet) use Plone Policy Product


         Data Providers
           Test fixtures
           Collection of example data for the tests
           Can contain a method for establishing the data used in the preset
           Simple dictionary of dictionaries

                  >>> from funittest import dataprovider
                  >>> dataprovider.cmfplone.user.get(quot;samplememberquot;)
                  {'visible_ids': True, 'roles': ['Member'], 'id':
                  'samplemember', 'groups': [], 'fullname': 'Sample
                  Member', 'password': 'seleniumtest', 'email':
                  'test@example.com', 'password_confirm': 'seleniumtest'}



         Tests
           Tests are reusable
           Tests are generic
           Reuse tests on all of your new Plone sites
           Add a generic test, use it everywhere
           Execute all tests:

                  python2.4 test.py
                  ...
                  ----------------------------------------------------------------------
                  Ran 3 tests in 0.148s

                  OK

           Uses standard Python unittest library


         Tests depend on the whole functional
         test stack
           Tests depend on all the other elements of the test stack
           Use a custom preset to decide what parts your stack should use


3 of 9                                                                               12/10/07 16:53
file:///Funittest.html


           Failing tests tell you
                 what to change in the stack
                 what to fix in your Plone site
           Run tests again until all tests pass
           Run tests again tomorrow to catch regressions


         Execute a single test
           Addable content test:
               Test that all expected content types are addable

                         python2.4 test.py --preset custom -t addablecontent
                         ['PloneGlossary not in list of addable types', ...]
                         ...

           Structure of a test class

                  class AddableContent(Test):
                       def setUp(self):
                           # No Setup here
                       def step_1(self):
                           # Verify expected addable types at Plone site
                  root
                       def test(self):
                           self.expect_ok(1)

           Tests are first class citizens


         Tests are testable
           Make tests fail to prove that they do something useful

                  python2.4 test.py --preset custom -t addablecontent -e
                  1b


                  class AddableContent(Test):
                      ...
                      def test_1b(self):
                          # Add bogus content type
                          self.expect_ko(1)
                          # Remove bogus content type
                          self.expect_ok(1)

           Forces the developer to write the verification code
           Verification can vary from site to site
           Verification can be effective on one site, and do nothing on another
           When the verification code changes for whatever reason, the test of the test
           fails




4 of 9                                                                                         12/10/07 16:53
file:///Funittest.html



         Verification
           Verification steps
                 Catch state before
                 Change expected state
                 Execute verb
                 Compare expected state and real state
           Verification is factored out

                  def submit(self, user):
                      element = quot;//dl[@class='portalMessage error']quot;
                      if interpreter.is_element_present(element):
                          interpreter.verifyNotVisible(element)

           Comprehensive verification
               Systematically verify general state on each action, not just in an isolated
               test


         Use Cases
           Put yourself into the position of the user
           What are the actions the user should be able to do?
           What is the main scenario?
           What are the alternative scenarios?
           What errors are possible?
           Write extension points


         'Register a new user' Use Case
           Registration of a new user to the Plone site
             1. Access the registration form
             2. Fill in the registration form
             3. Submit the registration form
             4. Directly log in to the site


         Find verbs in use case
           Taking the point of view of the user
           What is the user action in each step?
           quot;access registration formquot;, quot;fill in formquot;, quot;submitquot;, quot;login directlyquot;
           Group verbs in different logical functional models, like Application, Content,
           Folder, Navigation, Search
           New domain quot;registerquot;



5 of 9                                                                                            12/10/07 16:53
file:///Funittest.html



         Main Scenario Steps
           Write down scenario steps using the verbs from the new quot;registerquot; domain
           Define the steps of the main scenario calling the logical functional model

                  def step_1(self):
                      logical.cmfplone.register.access(self._user)

                  def step_2(self):
                      logical.cmfplone.register.fill(self._user)

                  def step_3(self):
                      logical.cmfplone.register.submit(self._user)

                  def step_4(self):
                      logical.cmfplone.register.direct_login(self._user)



         Scenario Schemas
           Schema contains scenario parameters

                      schema =
                  Schema({quot;userquot;:dataprovider.cmfplone.user})

           Make parameters available to scenario code


         Main Scenario
           Your main scenario is expected to work ok:

                  def scenario(self):
                      quot;quot;quot;
                      User registers
                      quot;quot;quot;
                      self.expect_ok(1,2,3,4)

           Execute scenario

                  python2.4 scenario.py --preset custom -s register



         Extension Points
           You define the extension points
           Fail at first
           If recovery is possibly, make scenario finish ok

                  def scenario_3a(self):



6 of 9                                                                                       12/10/07 16:53
file:///Funittest.html


                      quot;quot;quot;
                      User enters password different from the
                  confirmation password
                      quot;quot;quot;
                      password = self._user['password']
                      self._user['password']='differentfirstpassword'
                      self.expect_ko(1,2,3)
                      # Recover from the error by filling in the correct
                  password this time
                      self._user['password']=password
                      self.expect_ok(2,3,4)



         Using Scenarios from code
           Scenarios can be used from Python code like this

                  scenarios.cmfplone.register(user=user)

           Scenarios can be tried

                  scenarios.cmfplone.installproduct.try_scenario()

           Scenario steps can be tried

                  scenarios.cmfplone.addcontent.try_step(1)



         Logical Functional Model
           Define the logical functional model verbs

                  def access(self, user):
                      physical.cmfplone.register.access(user)

                  def fill(self, user):
                      physical.cmfplone.register.fill(user)

                  def submit(self, user):
                      physical.cmfplone.register.submit(user)

                  def direct_login(self, user):
                      physical.cmfplone.register.direct_login(user)



         Physical Model
           Implement the physical model methods

                  def access(self, user):
                      interpreter.open('/join_form')




7 of 9                                                                          12/10/07 16:53
file:///Funittest.html


                  def fill(self, user):
                      forms = physical.cmfplone.forms.getForms()
                      form =
                  forms.getFormByLocator(quot;//form[@action='join_form']quot;)
                      values = []
                      values.append( {'id':'fullname',
                                      'value':user['fullname']} )
                      values.append( {'id':'username',
                                      'value':user['id']} )
                      values.append( {'id':'email',
                                      'value':user['email']} )
                      values.append( {'id':'password',
                                      'value':user['password']} )
                      values.append( {'id':'password_confirm',
                                      'value':user['password_confirm']} )
                      form.fillForm(values)

                  def submit(self, user):
                      interpreter.clickAndWait(quot;form.button.Registerquot;)

                  def direct_login(self, user):
                      interpreter.annotate(quot;Login after registrationquot;)
                      interpreter.clickAndWait(quot;//input[@value='Log
                  in']quot;)



         Get Funittest
           Collective
           svn co https://svn.plone.org/svn/collective/funittest/trunk funittest
           cd funittest
           less README.txt
           Interactive browser demo of using Crunchy
           cd funittest/doc
           python crunchy.py


         Literature and Resources
           Funittest:
                 Plone Conference 2007 Sprint Page
                  http://www.openplans.org/projects/plone-conference-2007/funittest
           The Braidy Tester:
                 Functional Test Stack Articles
                  http://www.thebraidytester.com/
           Article by Jennitta Andrea
                 Brushing Up On Functional Test Effectiveness
                  http://www.stickyminds.com/s.asp?F=S9937_ART_2
           Book by Alistair Cockburn
                 Writing Effective Use Cases
                  http://alistair.cockburn.us/index.php/Resources_for_writing_use_cases



8 of 9                                                                                         12/10/07 16:53
file:///Funittest.html




         )




9 of 9        12/10/07 16:53

More Related Content

What's hot

Scryent: Plone - Hone Your Test Fu
Scryent: Plone - Hone Your Test FuScryent: Plone - Hone Your Test Fu
Scryent: Plone - Hone Your Test FuJordan Baker
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox testsKevin Beeman
 
Oh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to MutationOh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to MutationPaul Blundell
 
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019Sam Brannen
 
香港六合彩 » SlideShare
香港六合彩 » SlideShare香港六合彩 » SlideShare
香港六合彩 » SlideShareyayao
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Comunidade NetPonto
 
Some useful tips with qtp
Some useful tips with qtpSome useful tips with qtp
Some useful tips with qtpSandeep
 
Unit testing with PHPUnit - there's life outside of TDD
Unit testing with PHPUnit - there's life outside of TDDUnit testing with PHPUnit - there's life outside of TDD
Unit testing with PHPUnit - there's life outside of TDDPaweł Michalik
 
What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)Shaharyar khan
 
Grails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & FunctionalGrails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & Functional2Paths Solutions Ltd.
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)Jen Wong
 

What's hot (20)

Scryent: Plone - Hone Your Test Fu
Scryent: Plone - Hone Your Test FuScryent: Plone - Hone Your Test Fu
Scryent: Plone - Hone Your Test Fu
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
 
Oh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to MutationOh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to Mutation
 
AAA Automated Testing
AAA Automated TestingAAA Automated Testing
AAA Automated Testing
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
 
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
 
香港六合彩 » SlideShare
香港六合彩 » SlideShare香港六合彩 » SlideShare
香港六合彩 » SlideShare
 
Testing In Java
Testing In JavaTesting In Java
Testing In Java
 
Unit Testing in Java
Unit Testing in JavaUnit Testing in Java
Unit Testing in Java
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
 
Some useful tips with qtp
Some useful tips with qtpSome useful tips with qtp
Some useful tips with qtp
 
Unit testing with PHPUnit - there's life outside of TDD
Unit testing with PHPUnit - there's life outside of TDDUnit testing with PHPUnit - there's life outside of TDD
Unit testing with PHPUnit - there's life outside of TDD
 
Unit test
Unit testUnit test
Unit test
 
Cursus phpunit
Cursus phpunitCursus phpunit
Cursus phpunit
 
Testing 101
Testing 101Testing 101
Testing 101
 
Python testing
Python  testingPython  testing
Python testing
 
What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)
 
Grails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & FunctionalGrails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & Functional
 
Java Unit Testing
Java Unit TestingJava Unit Testing
Java Unit Testing
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
 

Similar to Plone Conference 2007: Acceptance Testing In Plone Using Funittest - Maik Röder

Unit testing php-unit - phing - selenium_v2
Unit testing   php-unit - phing - selenium_v2Unit testing   php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2Tricode (part of Dept)
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Puneet Kala
 
Making the most of your Test Suite
Making the most of your Test SuiteMaking the most of your Test Suite
Making the most of your Test Suiteericholscher
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 
Unit testing for 40 square software
Unit testing for 40 square softwareUnit testing for 40 square software
Unit testing for 40 square softwareRuben Tan
 
Frontend testing of (legacy) websites
Frontend testing of (legacy) websitesFrontend testing of (legacy) websites
Frontend testing of (legacy) websitesMichael Kubovic
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsNick Belhomme
 
ONOS System Test - ONS2016
ONOS System Test - ONS2016ONOS System Test - ONS2016
ONOS System Test - ONS2016Suibin Zhang
 
How to Build Your Own Test Automation Framework?
How to Build Your Own Test Automation Framework?How to Build Your Own Test Automation Framework?
How to Build Your Own Test Automation Framework?Dmitry Buzdin
 
Testing the frontend
Testing the frontendTesting the frontend
Testing the frontendHeiko Hardt
 
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...Amazon Web Services
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With SeleniumMarakana Inc.
 
Software development practices in python
Software development practices in pythonSoftware development practices in python
Software development practices in pythonJimmy Lai
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMSJustinHolt20
 

Similar to Plone Conference 2007: Acceptance Testing In Plone Using Funittest - Maik Röder (20)

Modern Python Testing
Modern Python TestingModern Python Testing
Modern Python Testing
 
Unit testing php-unit - phing - selenium_v2
Unit testing   php-unit - phing - selenium_v2Unit testing   php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 
Selenium Training in Chennai
Selenium Training in ChennaiSelenium Training in Chennai
Selenium Training in Chennai
 
Making the most of your Test Suite
Making the most of your Test SuiteMaking the most of your Test Suite
Making the most of your Test Suite
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
Unit testing for 40 square software
Unit testing for 40 square softwareUnit testing for 40 square software
Unit testing for 40 square software
 
Frontend testing of (legacy) websites
Frontend testing of (legacy) websitesFrontend testing of (legacy) websites
Frontend testing of (legacy) websites
 
Testing Ansible
Testing AnsibleTesting Ansible
Testing Ansible
 
Selenium
SeleniumSelenium
Selenium
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
 
ONOS System Test - ONS2016
ONOS System Test - ONS2016ONOS System Test - ONS2016
ONOS System Test - ONS2016
 
Codeception
CodeceptionCodeception
Codeception
 
How to Build Your Own Test Automation Framework?
How to Build Your Own Test Automation Framework?How to Build Your Own Test Automation Framework?
How to Build Your Own Test Automation Framework?
 
Testing the frontend
Testing the frontendTesting the frontend
Testing the frontend
 
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
Software development practices in python
Software development practices in pythonSoftware development practices in python
Software development practices in python
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMS
 
Sel
SelSel
Sel
 

More from maikroeder

Encode RNA Dashboard
Encode RNA DashboardEncode RNA Dashboard
Encode RNA Dashboardmaikroeder
 
Getting started with pandas
Getting started with pandasGetting started with pandas
Getting started with pandasmaikroeder
 
Introduction to ggplot2
Introduction to ggplot2Introduction to ggplot2
Introduction to ggplot2maikroeder
 
Repoze Bfg - presented by Rok Garbas at the Python Barcelona Meetup October 2...
Repoze Bfg - presented by Rok Garbas at the Python Barcelona Meetup October 2...Repoze Bfg - presented by Rok Garbas at the Python Barcelona Meetup October 2...
Repoze Bfg - presented by Rok Garbas at the Python Barcelona Meetup October 2...maikroeder
 
Cms - Content Management System Utilities for Django
Cms - Content Management System Utilities for DjangoCms - Content Management System Utilities for Django
Cms - Content Management System Utilities for Djangomaikroeder
 

More from maikroeder (7)

Google charts
Google chartsGoogle charts
Google charts
 
Encode RNA Dashboard
Encode RNA DashboardEncode RNA Dashboard
Encode RNA Dashboard
 
Pandas
PandasPandas
Pandas
 
Getting started with pandas
Getting started with pandasGetting started with pandas
Getting started with pandas
 
Introduction to ggplot2
Introduction to ggplot2Introduction to ggplot2
Introduction to ggplot2
 
Repoze Bfg - presented by Rok Garbas at the Python Barcelona Meetup October 2...
Repoze Bfg - presented by Rok Garbas at the Python Barcelona Meetup October 2...Repoze Bfg - presented by Rok Garbas at the Python Barcelona Meetup October 2...
Repoze Bfg - presented by Rok Garbas at the Python Barcelona Meetup October 2...
 
Cms - Content Management System Utilities for Django
Cms - Content Management System Utilities for DjangoCms - Content Management System Utilities for Django
Cms - Content Management System Utilities for Django
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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 CVKhem
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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)wesley chun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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 organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
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...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Plone Conference 2007: Acceptance Testing In Plone Using Funittest - Maik Röder

  • 1. file:///Funittest.html Acceptance Testing for Plone Using Funittest Plone Conference 2007 Maik Röder Yaco Sistemas maikroeder@gmail.com Acceptance Testing Agile software development methodology Extreme Programming Functional testing of a user story during the implementation phase Black box system tests Regression tests prior to a production release. Requirements Or, what I expect from a functional testing system Use case centered High level Readability Reusability Extensibility Modularization Simple elegance Acceptance Testing for Plone with Funittest Write acceptance test first Test driven development Guarantee the quality of your Plone sites Untested sites are broken sites Run in-browser acceptance tests Selenium Remote Control 1 of 9 12/10/07 16:53
  • 2. file:///Funittest.html Real TestBrowser Extensive library of reusable scripts, verbs, scenarios and tests History Selenium PloneSelenium PLIP #100: Integrate Selenium for functional testing Funittest Funittest sprint Development with Funittest Documentation driven development Start with the Use Cases Tell a story of what the user does step by step Write new use case scenarios or extensions Developers may find documentation and think about other extensions Write high-level, domain-specific, vocabulary for each new user action Write new low level methods for vocabulary Write new functional tests reusing the scenarios Write new verification code outside of tests Presets Prepare a site for tests Add sample users to the site for testing Make changes to the site settings to facilitate testing Presets for Plone 3 and Plone 2.5 exist Simple Python file with a preset method Presets are run against a Plone site to make it establish data providers def preset(): load_funittest_model(quot;funittest.lib.plone301.cmfplonequot;) interpreter.setBrowserURL(quot;http://localhost:8080/Plonequot;) dataprovider.cmfplone.user.current = ['admin', 'samplemanager', 'samplemember'] return [dataprovider.cmfplone.user] Custom presets 2 of 9 12/10/07 16:53
  • 3. file:///Funittest.html Each of your Plone projects should have a custom preset Have a look at the example Custom preset for implementing your own Run a preset against your Plone site: python preset.py --preset myproject Plone site is ready for testing Does not (yet) use Plone Policy Product Data Providers Test fixtures Collection of example data for the tests Can contain a method for establishing the data used in the preset Simple dictionary of dictionaries >>> from funittest import dataprovider >>> dataprovider.cmfplone.user.get(quot;samplememberquot;) {'visible_ids': True, 'roles': ['Member'], 'id': 'samplemember', 'groups': [], 'fullname': 'Sample Member', 'password': 'seleniumtest', 'email': 'test@example.com', 'password_confirm': 'seleniumtest'} Tests Tests are reusable Tests are generic Reuse tests on all of your new Plone sites Add a generic test, use it everywhere Execute all tests: python2.4 test.py ... ---------------------------------------------------------------------- Ran 3 tests in 0.148s OK Uses standard Python unittest library Tests depend on the whole functional test stack Tests depend on all the other elements of the test stack Use a custom preset to decide what parts your stack should use 3 of 9 12/10/07 16:53
  • 4. file:///Funittest.html Failing tests tell you what to change in the stack what to fix in your Plone site Run tests again until all tests pass Run tests again tomorrow to catch regressions Execute a single test Addable content test: Test that all expected content types are addable python2.4 test.py --preset custom -t addablecontent ['PloneGlossary not in list of addable types', ...] ... Structure of a test class class AddableContent(Test): def setUp(self): # No Setup here def step_1(self): # Verify expected addable types at Plone site root def test(self): self.expect_ok(1) Tests are first class citizens Tests are testable Make tests fail to prove that they do something useful python2.4 test.py --preset custom -t addablecontent -e 1b class AddableContent(Test): ... def test_1b(self): # Add bogus content type self.expect_ko(1) # Remove bogus content type self.expect_ok(1) Forces the developer to write the verification code Verification can vary from site to site Verification can be effective on one site, and do nothing on another When the verification code changes for whatever reason, the test of the test fails 4 of 9 12/10/07 16:53
  • 5. file:///Funittest.html Verification Verification steps Catch state before Change expected state Execute verb Compare expected state and real state Verification is factored out def submit(self, user): element = quot;//dl[@class='portalMessage error']quot; if interpreter.is_element_present(element): interpreter.verifyNotVisible(element) Comprehensive verification Systematically verify general state on each action, not just in an isolated test Use Cases Put yourself into the position of the user What are the actions the user should be able to do? What is the main scenario? What are the alternative scenarios? What errors are possible? Write extension points 'Register a new user' Use Case Registration of a new user to the Plone site 1. Access the registration form 2. Fill in the registration form 3. Submit the registration form 4. Directly log in to the site Find verbs in use case Taking the point of view of the user What is the user action in each step? quot;access registration formquot;, quot;fill in formquot;, quot;submitquot;, quot;login directlyquot; Group verbs in different logical functional models, like Application, Content, Folder, Navigation, Search New domain quot;registerquot; 5 of 9 12/10/07 16:53
  • 6. file:///Funittest.html Main Scenario Steps Write down scenario steps using the verbs from the new quot;registerquot; domain Define the steps of the main scenario calling the logical functional model def step_1(self): logical.cmfplone.register.access(self._user) def step_2(self): logical.cmfplone.register.fill(self._user) def step_3(self): logical.cmfplone.register.submit(self._user) def step_4(self): logical.cmfplone.register.direct_login(self._user) Scenario Schemas Schema contains scenario parameters schema = Schema({quot;userquot;:dataprovider.cmfplone.user}) Make parameters available to scenario code Main Scenario Your main scenario is expected to work ok: def scenario(self): quot;quot;quot; User registers quot;quot;quot; self.expect_ok(1,2,3,4) Execute scenario python2.4 scenario.py --preset custom -s register Extension Points You define the extension points Fail at first If recovery is possibly, make scenario finish ok def scenario_3a(self): 6 of 9 12/10/07 16:53
  • 7. file:///Funittest.html quot;quot;quot; User enters password different from the confirmation password quot;quot;quot; password = self._user['password'] self._user['password']='differentfirstpassword' self.expect_ko(1,2,3) # Recover from the error by filling in the correct password this time self._user['password']=password self.expect_ok(2,3,4) Using Scenarios from code Scenarios can be used from Python code like this scenarios.cmfplone.register(user=user) Scenarios can be tried scenarios.cmfplone.installproduct.try_scenario() Scenario steps can be tried scenarios.cmfplone.addcontent.try_step(1) Logical Functional Model Define the logical functional model verbs def access(self, user): physical.cmfplone.register.access(user) def fill(self, user): physical.cmfplone.register.fill(user) def submit(self, user): physical.cmfplone.register.submit(user) def direct_login(self, user): physical.cmfplone.register.direct_login(user) Physical Model Implement the physical model methods def access(self, user): interpreter.open('/join_form') 7 of 9 12/10/07 16:53
  • 8. file:///Funittest.html def fill(self, user): forms = physical.cmfplone.forms.getForms() form = forms.getFormByLocator(quot;//form[@action='join_form']quot;) values = [] values.append( {'id':'fullname', 'value':user['fullname']} ) values.append( {'id':'username', 'value':user['id']} ) values.append( {'id':'email', 'value':user['email']} ) values.append( {'id':'password', 'value':user['password']} ) values.append( {'id':'password_confirm', 'value':user['password_confirm']} ) form.fillForm(values) def submit(self, user): interpreter.clickAndWait(quot;form.button.Registerquot;) def direct_login(self, user): interpreter.annotate(quot;Login after registrationquot;) interpreter.clickAndWait(quot;//input[@value='Log in']quot;) Get Funittest Collective svn co https://svn.plone.org/svn/collective/funittest/trunk funittest cd funittest less README.txt Interactive browser demo of using Crunchy cd funittest/doc python crunchy.py Literature and Resources Funittest: Plone Conference 2007 Sprint Page http://www.openplans.org/projects/plone-conference-2007/funittest The Braidy Tester: Functional Test Stack Articles http://www.thebraidytester.com/ Article by Jennitta Andrea Brushing Up On Functional Test Effectiveness http://www.stickyminds.com/s.asp?F=S9937_ART_2 Book by Alistair Cockburn Writing Effective Use Cases http://alistair.cockburn.us/index.php/Resources_for_writing_use_cases 8 of 9 12/10/07 16:53
  • 9. file:///Funittest.html ) 9 of 9 12/10/07 16:53