SlideShare a Scribd company logo
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 Fu
Jordan Baker
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
Kevin 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 Mutation
Paul Blundell
 
AAA Automated Testing
AAA Automated TestingAAA Automated Testing
AAA Automated Testing
Francesco Carucci
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
Thomas Zimmermann
 
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
Sam Brannen
 
香港六合彩 » SlideShare
香港六合彩 » SlideShare香港六合彩 » SlideShare
香港六合彩 » SlideShare
yayao
 
Testing In Java
Testing In JavaTesting In Java
Testing In Java
Adrian Treacy
 
Unit Testing in Java
Unit Testing in JavaUnit Testing in Java
Unit Testing in Java
Ahmed M. Gomaa
 
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 qtp
Sandeep
 
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
Paweł Michalik
 
Unit test
Unit testUnit test
Cursus phpunit
Cursus phpunitCursus phpunit
Cursus phpunit
Nick Belhomme
 
Testing 101
Testing 101Testing 101
Testing 101
Noam Barkai
 
Python testing
Python  testingPython  testing
Python testing
John(Qiang) Zhang
 
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 & Functional
2Paths Solutions Ltd.
 
Java Unit Testing
Java Unit TestingJava Unit Testing
Java Unit Testing
Nayanda Haberty
 
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

Modern Python Testing
Modern Python TestingModern Python Testing
Modern Python Testing
Alexander Loechel
 
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
Tricode (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
 
Selenium Training in Chennai
Selenium Training in ChennaiSelenium Training in Chennai
Selenium Training in Chennai
Thecreating Experts
 
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
ericholscher
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
Dave Haeffner
 
Unit testing for 40 square software
Unit testing for 40 square softwareUnit testing for 40 square software
Unit testing for 40 square software
Ruben Tan
 
Frontend testing of (legacy) websites
Frontend testing of (legacy) websitesFrontend testing of (legacy) websites
Frontend testing of (legacy) websites
Michael Kubovic
 
Testing Ansible
Testing AnsibleTesting Ansible
Testing Ansible
Anth Courtney
 
Selenium
SeleniumSelenium
Selenium
Sun Technlogies
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
Nick Belhomme
 
ONOS System Test - ONS2016
ONOS System Test - ONS2016ONOS System Test - ONS2016
ONOS System Test - ONS2016
Suibin Zhang
 
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?
Dmitry Buzdin
 
Testing the frontend
Testing the frontendTesting the frontend
Testing the frontend
Heiko 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 Selenium
Marakana Inc.
 
Software development practices in python
Software development practices in pythonSoftware development practices in python
Software development practices in python
Jimmy Lai
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMS
JustinHolt20
 
Sel
SelSel

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

Google charts
Google chartsGoogle charts
Google charts
maikroeder
 
Encode RNA Dashboard
Encode RNA DashboardEncode RNA Dashboard
Encode RNA Dashboard
maikroeder
 
Pandas
PandasPandas
Pandas
maikroeder
 
Getting started with pandas
Getting started with pandasGetting started with pandas
Getting started with pandas
maikroeder
 
Introduction to ggplot2
Introduction to ggplot2Introduction to ggplot2
Introduction to ggplot2
maikroeder
 
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 Django
maikroeder
 

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

UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 

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