UPC Plone Testing Talk
Upcoming SlideShare
Loading in...5
×
 

UPC Plone Testing Talk

on

  • 920 views

 

Statistics

Views

Total Views
920
Views on SlideShare
918
Embed Views
2

Actions

Likes
0
Downloads
3
Comments
0

1 Embed 2

http://www.linkedin.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

UPC Plone Testing Talk UPC Plone Testing Talk Presentation Transcript

  • Testing for fun and profit March, 11th 2010 Timo Stollenwerk
  • Are you still testing manually? ● Are you testing the applications you write? ● You are already testing, but in an inefficient way! ● Manual testing is boring and inefficient! ● Automated testing makes development more effective and more fun!
  • Create a new Plone content type
  • Start Zope
  • Create Plone Site
  • Install Product
  • Test Adding Manually
  • Error!
  • Test View Manually
  • What sucks about this process? ● You have to create/start/install/test your product over and over again ● You have to write the entire code before you can test it ● You end up with a lot of errors and you don't really know what is causing it ● Manual testing is slow and error-prone! ● Repetitive tasks are boring!
  • Development Process Improvement ● Automate the entire process ● Write tests that can tell you what exactly went wrong ● Fixing lots of small pieces of code mean lots of small successes ● Prove that your code does what it is supposed to do ● Make development more fun!
  • What Do We Want To Test? ● Schema ● Factory Type Information ● Factory ● Adding ● View ● ...
  • Create Schema
  • Test Schema
  • Run your tests
  • Create Content Type
  • Test Factory Type Information
  • Test Factory
  • Error!
  • Test Adding
  • Test View
  • Why Testing Matters ● Testing reduces defects as measured by reported bugs ● Finding bugs early makes them cheaper to fix ● Tests passing is proof that you delivered what you were contracted to produce ● Refactor with confidence ● Lot of small steps means lot of small successes
  • Testing Pyramid
  • Functional Testing ● Blackbox testing ● Automated acceptance testing
  • XP/Scrum and Functional Testing ● Testing started as part of XP ● Acceptance tests can map directly to your software requirements ● XP/Scrum: ● Write testable specifications ● Write code that complies with the specification and tests ● Use the testable specification to prove that your application is doing what it is supposed to do
  • Telling User Stories with Doctests As a logged-in user, I can add a new Task to the website.
  • Doctest Example
  • Unit Tests in Plone
  • Unit Testing CODE: def is_palindrome(input_str): pass TEST: def test_palindromic_word(): input = "noon" assert is_palindrome(input) == True
  • Testing one unit at a time ● Usually you have to set up some components in order to test a Unit ● But how?
  • Mock And Fake Objects ● Unittest code that has external dependencies ● Plone components ● External databases ● Network connections ● Depends on external components
  • Mock Testing Example
  • Test Driven Development ● Write a testable specification ● Write integration tests ● Write Unit Tests ● Write code that complies with the specification and tests ● Use the testable specification and unit tests to help debug/refactor
  • More Testing Topics ● Code Coverage ● Twill ● Selenium ● zope.testrecorder ● Continuous Integration ● IDE Integration
  • Code Resources ● Code for this talk upc.testingtutorial ● https://devel.upcnet.es/svn/upcnet/upc.testingtutorial/ ● UPC Deploymentmanager ● https://devel.upcnet.es/svn/upcnet/upc.deploymentmana ● Recent Activity Portlet ● http://pypi.python.org/pypi/collective.portlet.recentactivit ● plone.app.discussion ● http://pypi.python.org/pypi/plone.app.discussion
  • Testing Resources ● Plone Testing Tutorial ● http://plone.org/documentation/kb/testing ● Plone 3 / Archetypes ● PPD / Optilux ● Plone 4 / Dexterity Dev Manual ● http://plone.org/products/dexterity/documentation/manu ● Example Package: http://svn.plone.org/svn/collective/example.conferen ce/
  • Books about Testing ● Kent Beck: Test Driven Development ● http://www.amazon.com/Test-Driven-Development-Kent ● Python Testing: Beginner's Guide ● http://www.packtpub.com/python-testing-beginners-guid ● Tarek Ziadé: Expert Python Programming ● http://www.amazon.com/Expert-Python- Programming-practices- distributing/dp/184719494X/ref=sr_1_1? ie=UTF8&s=books&qid=1268299804&sr=1-1-spell
  • The End