SlideShare a Scribd company logo
1 of 26
dylan@pretaweb.comPloneConf 2009 Dylan Jay
TestBrowser Driven Development
How to get bulletproof code from lazy developers
Dylan Jay
djay@pretaweb.com
dylan@pretaweb.comPloneConf 2009 Dylan Jay
• Dylan Jay
• 6 years with Plone
• Large corporate Java/Rational Unified process
background
• Co-founder of PretaWeb in Australia
• Started pretaweb.funnelweb, collective.hostout,
Products.LoginLockout
(and way way back RemoteUserFolder)
About me
dylan@pretaweb.comPloneConf 2009 Dylan Jay
What this talk is about
• Story of how we delivered the difficult (previous
failures)
• Communication
• Users ↔ Business Analyst
• Business Analyst ↔ Developers
• For project managers, business analysts,
technical leads
• But also for solo development
dylan@pretaweb.comPloneConf 2009 Dylan Jay
The story begins...
• Gov. department
• Complex Workflow Application of sensitive info
– generating certificates
• BA 40% Dev 60% + support
• Fixed price + fixed deadline.
• Sold them on scrum … without mentioning
scrum
• Used hybrid SCUM + usecase analysis
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Roles: reference
• BA: Business Analyst - Extract requirements
from client and produce requirements
document. Traditionally job ends before code
begins
• PO: Product Owner - In SCRUM: Sort of like a
BA who sticks around. Go to person.
• Dev: Developer - People who want solve code
problems not user problems :)
• ST/QA: System Tester - Non-developers there
to break developers work
dylan@pretaweb.comPloneConf 2009 Dylan Jay
CRC Card sessions
• Class, Responsibility, Collaboration
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Use-case analysis
Great for workflow/edge cases
• Usecase:
– 1 main scenario (sunny day)
– ~30 alternate scenarions (rainy day)
• Challenge - level of detail
– Premature detail vs. not enough
• ~50 scenarios
• 43 page word doc including non-functional
requirements
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Paper Based Prototype
• http://www.balsamiq.com/products/mockups
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Stories vs Usecases
• We used SCRUM
• SCRUM uses Stories
• Stories are good for estimation
• Stories group functionality vs. Scenarios runs
across functionality
• We
– Broke large scenario into three stories
– Grouped 3-4 related scenarios into stories
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Unit Testing
1 Code
2 Write test
3 Run test: it succeeds
4 Refactor
5 Run test: it succeeds
• Tests are code
• Test functions/API
• Tests run fast
• Tests run often
• Tests run after every
change
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Unit Testing – scorecard
• Communication of requirements - x
• Validation of requirements – x
• Prevent regressions - ✓
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Doctests
• Structured text document
• Tells a story
• Tells a story with EXAMPLES THAT WORK!
• Code interleaved
• Output checked against actual == test
• docstring or standalone doctests
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Functional Testing
• Test system from outside – GUI after
development
• Written from user perspective
• Easy to write – write it as you would use it
• Usecase = test
• Often done by separate team – system testers
• Often done just before delivery
• Example: selenium
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Selenium
dylan@pretaweb.comPloneConf 2009 Dylan Jay
zc.testbrowser an api browser
Easy to keep in your head – fun - natural
browser.getControl(label=None, name=None, index=None)
/.options /.value /.click()
browser.getLink(text=None, url=None, id=None)
/.click()
browser.open(url)
brower.goBack()
browser.reload()
print browser.contents
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Usecases to tests
• Dev: Branch created
• Dev: Scenarios copied to StoryX.txt
• Dev: Code developed
• Dev: StoryX.txt augmented with testbrowser
• Dev: All Tests pass
• PO: Code + test reviewed
• PO: Branch merged
dylan@pretaweb.comPloneConf 2009 Dylan Jay
TestBrowser extras
• Doesn't do javascript
• But zc.testbrowser.real does
– Requires firefox
• Zope.testrecorder
– Generate tests from GUI
• With Plone use roadrunner
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Still not working...
• Implemented wrong thing – rework
• Usecases not detailed enough
• Lazy BA – didn't want tell developers how to do
it
• Lazy developers – didn't want at the user level
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Functional Test Driven Development
• PO: Branch created
• PO: Scenarios copied to StoryX.txt
• PO: StoryX.txt augmented with tests (sort of)
• Dev: Code developed
• Dev: Test finished off
• Dev: All tests pass
• PO: Code + test reviewed
• PO: Branch merged
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Our process – Bugs
• Dev: Branch created
• Dev: StoryX.txt add in bug condition
• Dev: Show test fails
• Dev: Code fixed
• Dev: All tests pass
• PO: Code + test reviewed
• PO: Branch merged
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Test Driven Development
1 Write test
2 Run test: it fails
3 Fix code
4 Run test: it succeeds
5 Refactor
6 Run test: it succeeds
7 Repeat
• Write tests before
code
• red/green/refactor
– First fail then fix
• Forces you to
understand
requirements before
writing code
dylan@pretaweb.comPloneConf 2009 Dylan Jay
TestBrowser Driven Development
• Communication of requirements - ✓
– Level of detail right
• Easy – ✓
– Technical PO can do it in reasonable time
• Validation of requirements – ✓
– Easy to see changes to tests
• Prevent regressions - ✓
– Test suite run after any change e.g. 1862 bug
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Example: URL Shortener
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Proposal: Screenshot gen
• Testbrowser statements → screenshot
• Highlight action or comparison in screenshot
• Doctests with pictures and no code
• A better pypi & Plone Software Center
• Documentation Driven Development
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Conclusion
• ~50 usecases
– all turned into doctests and extended
– Living requirements/documention
• Quality was very important
– delivered with peace of mind
• Tight deadline, tight budget
– delivered on time on budget
• Lazy developers
– less rework, less delays = $$$
dylan@pretaweb.comPloneConf 2009 Dylan Jay
Credits
http://docs.python.org/library/doctest.html
http://pypi.python.org/pypi/zc.testbrowser
http://plone.org/documentation/tutorial/testing/functional-tests

More Related Content

What's hot

What's hot (20)

Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 
End-to-end performance testing, profiling, and analysis at Redis
End-to-end performance testing, profiling, and analysis at RedisEnd-to-end performance testing, profiling, and analysis at Redis
End-to-end performance testing, profiling, and analysis at Redis
 
Presentation delex
Presentation delexPresentation delex
Presentation delex
 
Approval Tests in Action: A LEGO Exercise and an Experience Report
Approval Tests in Action: A LEGO Exercise and an Experience ReportApproval Tests in Action: A LEGO Exercise and an Experience Report
Approval Tests in Action: A LEGO Exercise and an Experience Report
 
Introduction to test_driven_development
Introduction to test_driven_developmentIntroduction to test_driven_development
Introduction to test_driven_development
 
Security Implications for a DevOps Transformation
Security Implications for a DevOps TransformationSecurity Implications for a DevOps Transformation
Security Implications for a DevOps Transformation
 
Apex triggers i
Apex triggers iApex triggers i
Apex triggers i
 
Continuous delivery from the trenches
Continuous delivery from the trenchesContinuous delivery from the trenches
Continuous delivery from the trenches
 
АНТОН МУЖАЙЛО «Test Team Development and Management Techniques»
АНТОН МУЖАЙЛО «Test Team Development and Management Techniques»АНТОН МУЖАЙЛО «Test Team Development and Management Techniques»
АНТОН МУЖАЙЛО «Test Team Development and Management Techniques»
 
Story Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium FrameworkStory Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium Framework
 
Benefits from AATs
Benefits from AATsBenefits from AATs
Benefits from AATs
 
deliver:agile - Enable your Agile Team with Continuous Delivery Pipelines
deliver:agile - Enable your Agile Team with Continuous Delivery Pipelinesdeliver:agile - Enable your Agile Team with Continuous Delivery Pipelines
deliver:agile - Enable your Agile Team with Continuous Delivery Pipelines
 
How to write better tests with Test Driven Development
How to write better tests with Test Driven DevelopmentHow to write better tests with Test Driven Development
How to write better tests with Test Driven Development
 
Why your company loves to welcome change but sucks at accommodating it
Why your company loves to welcome change but sucks at accommodating itWhy your company loves to welcome change but sucks at accommodating it
Why your company loves to welcome change but sucks at accommodating it
 
Inside Behavior Driven Development
Inside Behavior Driven DevelopmentInside Behavior Driven Development
Inside Behavior Driven Development
 
#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?
#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?
#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?
 
Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014
 
Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and Automation
 
Test Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s PerspectiveTest Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s Perspective
 
Enterprise Workflows When You Aren't Enterprise
Enterprise Workflows When You Aren't EnterpriseEnterprise Workflows When You Aren't Enterprise
Enterprise Workflows When You Aren't Enterprise
 

Viewers also liked (7)

Cool garden signs
Cool garden signsCool garden signs
Cool garden signs
 
Teacher workshop 8 24 2012
Teacher workshop 8 24 2012Teacher workshop 8 24 2012
Teacher workshop 8 24 2012
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Agile Software Development Process
Agile Software Development ProcessAgile Software Development Process
Agile Software Development Process
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Software Development Outsourcing - Total Cost Of Engagement Tce
Software Development Outsourcing - Total Cost Of Engagement TceSoftware Development Outsourcing - Total Cost Of Engagement Tce
Software Development Outsourcing - Total Cost Of Engagement Tce
 

Similar to TestBrowser Driven Development: How to get bulletproof code from lazy developers

JIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael MarchJIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael March
Atlassian
 

Similar to TestBrowser Driven Development: How to get bulletproof code from lazy developers (20)

Developers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonDevelopers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomon
 
Start with passing tests (tdd for bugs) v0.5 (22 sep 2016)
Start with passing tests (tdd for bugs) v0.5 (22 sep 2016)Start with passing tests (tdd for bugs) v0.5 (22 sep 2016)
Start with passing tests (tdd for bugs) v0.5 (22 sep 2016)
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...
 
Making security-agile matt-tesauro
Making security-agile matt-tesauroMaking security-agile matt-tesauro
Making security-agile matt-tesauro
 
Automated testing in javascript
Automated testing in javascriptAutomated testing in javascript
Automated testing in javascript
 
Continuous Testing
Continuous TestingContinuous Testing
Continuous Testing
 
Continuous Testing 2016
Continuous Testing 2016Continuous Testing 2016
Continuous Testing 2016
 
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austinDev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
 
What is DevOps
What is DevOpsWhat is DevOps
What is DevOps
 
What is this agile thing anyway
What is this agile thing anywayWhat is this agile thing anyway
What is this agile thing anyway
 
Building a custom cms with django
Building a custom cms with djangoBuilding a custom cms with django
Building a custom cms with django
 
14 Habits of Great SQL Developers
14 Habits of Great SQL Developers14 Habits of Great SQL Developers
14 Habits of Great SQL Developers
 
Road to Continuous Delivery - Wix.com
Road to Continuous Delivery - Wix.comRoad to Continuous Delivery - Wix.com
Road to Continuous Delivery - Wix.com
 
From inheritance to maintenance: restructuring your projects – Unite Copenhag...
From inheritance to maintenance: restructuring your projects – Unite Copenhag...From inheritance to maintenance: restructuring your projects – Unite Copenhag...
From inheritance to maintenance: restructuring your projects – Unite Copenhag...
 
JIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael MarchJIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael March
 
Django production
Django productionDjango production
Django production
 
Continuous Integration as a Development Team’s Way of Life
Continuous Integration as a Development Team’s Way of LifeContinuous Integration as a Development Team’s Way of Life
Continuous Integration as a Development Team’s Way of Life
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill Ayers
 
Continuous delivery @wcap 5-09-2013
Continuous delivery   @wcap 5-09-2013Continuous delivery   @wcap 5-09-2013
Continuous delivery @wcap 5-09-2013
 
BrainQuest-DevOps
BrainQuest-DevOpsBrainQuest-DevOps
BrainQuest-DevOps
 

More from Dylan Jay

Surviving an earthquake's worth of traffic
Surviving an earthquake's worth of trafficSurviving an earthquake's worth of traffic
Surviving an earthquake's worth of traffic
Dylan Jay
 

More from Dylan Jay (14)

5 things STILL! TOO! HARD! in Plone 5
5 things STILL! TOO! HARD! in Plone 55 things STILL! TOO! HARD! in Plone 5
5 things STILL! TOO! HARD! in Plone 5
 
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
 
The goodies of zope, pyramid, and plone (2)
The goodies of zope, pyramid, and plone (2)The goodies of zope, pyramid, and plone (2)
The goodies of zope, pyramid, and plone (2)
 
Surviving an earthquake's worth of traffic
Surviving an earthquake's worth of trafficSurviving an earthquake's worth of traffic
Surviving an earthquake's worth of traffic
 
TTW FTW: Plone as the new wordpress
TTW FTW: Plone as the new wordpressTTW FTW: Plone as the new wordpress
TTW FTW: Plone as the new wordpress
 
Plone pwns
Plone pwnsPlone pwns
Plone pwns
 
Buildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mindBuildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mind
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web apps
 
Plone: The CMS that hits above it's weight
Plone: The CMS that hits above it's weightPlone: The CMS that hits above it's weight
Plone: The CMS that hits above it's weight
 
Opps I deployed it again-ploneconf2010
Opps I deployed it again-ploneconf2010Opps I deployed it again-ploneconf2010
Opps I deployed it again-ploneconf2010
 
Funnelweb ploneconf2010
Funnelweb ploneconf2010Funnelweb ploneconf2010
Funnelweb ploneconf2010
 
Opps i deployed it again
Opps i deployed it againOpps i deployed it again
Opps i deployed it again
 
Plone for python programmers
Plone for python programmersPlone for python programmers
Plone for python programmers
 
How to host an app for $20 in 20min using buildout and hostout
How to host an app  for $20 in 20min using buildout and hostoutHow to host an app  for $20 in 20min using buildout and hostout
How to host an app for $20 in 20min using buildout and hostout
 

Recently uploaded

Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Recently uploaded (20)

Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 

TestBrowser Driven Development: How to get bulletproof code from lazy developers

  • 1. dylan@pretaweb.comPloneConf 2009 Dylan Jay TestBrowser Driven Development How to get bulletproof code from lazy developers Dylan Jay djay@pretaweb.com
  • 2. dylan@pretaweb.comPloneConf 2009 Dylan Jay • Dylan Jay • 6 years with Plone • Large corporate Java/Rational Unified process background • Co-founder of PretaWeb in Australia • Started pretaweb.funnelweb, collective.hostout, Products.LoginLockout (and way way back RemoteUserFolder) About me
  • 3. dylan@pretaweb.comPloneConf 2009 Dylan Jay What this talk is about • Story of how we delivered the difficult (previous failures) • Communication • Users ↔ Business Analyst • Business Analyst ↔ Developers • For project managers, business analysts, technical leads • But also for solo development
  • 4. dylan@pretaweb.comPloneConf 2009 Dylan Jay The story begins... • Gov. department • Complex Workflow Application of sensitive info – generating certificates • BA 40% Dev 60% + support • Fixed price + fixed deadline. • Sold them on scrum … without mentioning scrum • Used hybrid SCUM + usecase analysis
  • 5. dylan@pretaweb.comPloneConf 2009 Dylan Jay Roles: reference • BA: Business Analyst - Extract requirements from client and produce requirements document. Traditionally job ends before code begins • PO: Product Owner - In SCRUM: Sort of like a BA who sticks around. Go to person. • Dev: Developer - People who want solve code problems not user problems :) • ST/QA: System Tester - Non-developers there to break developers work
  • 6. dylan@pretaweb.comPloneConf 2009 Dylan Jay CRC Card sessions • Class, Responsibility, Collaboration
  • 7. dylan@pretaweb.comPloneConf 2009 Dylan Jay Use-case analysis Great for workflow/edge cases • Usecase: – 1 main scenario (sunny day) – ~30 alternate scenarions (rainy day) • Challenge - level of detail – Premature detail vs. not enough • ~50 scenarios • 43 page word doc including non-functional requirements
  • 8. dylan@pretaweb.comPloneConf 2009 Dylan Jay Paper Based Prototype • http://www.balsamiq.com/products/mockups
  • 9. dylan@pretaweb.comPloneConf 2009 Dylan Jay Stories vs Usecases • We used SCRUM • SCRUM uses Stories • Stories are good for estimation • Stories group functionality vs. Scenarios runs across functionality • We – Broke large scenario into three stories – Grouped 3-4 related scenarios into stories
  • 10. dylan@pretaweb.comPloneConf 2009 Dylan Jay Unit Testing 1 Code 2 Write test 3 Run test: it succeeds 4 Refactor 5 Run test: it succeeds • Tests are code • Test functions/API • Tests run fast • Tests run often • Tests run after every change
  • 11. dylan@pretaweb.comPloneConf 2009 Dylan Jay Unit Testing – scorecard • Communication of requirements - x • Validation of requirements – x • Prevent regressions - ✓
  • 12. dylan@pretaweb.comPloneConf 2009 Dylan Jay Doctests • Structured text document • Tells a story • Tells a story with EXAMPLES THAT WORK! • Code interleaved • Output checked against actual == test • docstring or standalone doctests
  • 13. dylan@pretaweb.comPloneConf 2009 Dylan Jay Functional Testing • Test system from outside – GUI after development • Written from user perspective • Easy to write – write it as you would use it • Usecase = test • Often done by separate team – system testers • Often done just before delivery • Example: selenium
  • 15. dylan@pretaweb.comPloneConf 2009 Dylan Jay zc.testbrowser an api browser Easy to keep in your head – fun - natural browser.getControl(label=None, name=None, index=None) /.options /.value /.click() browser.getLink(text=None, url=None, id=None) /.click() browser.open(url) brower.goBack() browser.reload() print browser.contents
  • 16. dylan@pretaweb.comPloneConf 2009 Dylan Jay Usecases to tests • Dev: Branch created • Dev: Scenarios copied to StoryX.txt • Dev: Code developed • Dev: StoryX.txt augmented with testbrowser • Dev: All Tests pass • PO: Code + test reviewed • PO: Branch merged
  • 17. dylan@pretaweb.comPloneConf 2009 Dylan Jay TestBrowser extras • Doesn't do javascript • But zc.testbrowser.real does – Requires firefox • Zope.testrecorder – Generate tests from GUI • With Plone use roadrunner
  • 18. dylan@pretaweb.comPloneConf 2009 Dylan Jay Still not working... • Implemented wrong thing – rework • Usecases not detailed enough • Lazy BA – didn't want tell developers how to do it • Lazy developers – didn't want at the user level
  • 19. dylan@pretaweb.comPloneConf 2009 Dylan Jay Functional Test Driven Development • PO: Branch created • PO: Scenarios copied to StoryX.txt • PO: StoryX.txt augmented with tests (sort of) • Dev: Code developed • Dev: Test finished off • Dev: All tests pass • PO: Code + test reviewed • PO: Branch merged
  • 20. dylan@pretaweb.comPloneConf 2009 Dylan Jay Our process – Bugs • Dev: Branch created • Dev: StoryX.txt add in bug condition • Dev: Show test fails • Dev: Code fixed • Dev: All tests pass • PO: Code + test reviewed • PO: Branch merged
  • 21. dylan@pretaweb.comPloneConf 2009 Dylan Jay Test Driven Development 1 Write test 2 Run test: it fails 3 Fix code 4 Run test: it succeeds 5 Refactor 6 Run test: it succeeds 7 Repeat • Write tests before code • red/green/refactor – First fail then fix • Forces you to understand requirements before writing code
  • 22. dylan@pretaweb.comPloneConf 2009 Dylan Jay TestBrowser Driven Development • Communication of requirements - ✓ – Level of detail right • Easy – ✓ – Technical PO can do it in reasonable time • Validation of requirements – ✓ – Easy to see changes to tests • Prevent regressions - ✓ – Test suite run after any change e.g. 1862 bug
  • 23. dylan@pretaweb.comPloneConf 2009 Dylan Jay Example: URL Shortener
  • 24. dylan@pretaweb.comPloneConf 2009 Dylan Jay Proposal: Screenshot gen • Testbrowser statements → screenshot • Highlight action or comparison in screenshot • Doctests with pictures and no code • A better pypi & Plone Software Center • Documentation Driven Development
  • 25. dylan@pretaweb.comPloneConf 2009 Dylan Jay Conclusion • ~50 usecases – all turned into doctests and extended – Living requirements/documention • Quality was very important – delivered with peace of mind • Tight deadline, tight budget – delivered on time on budget • Lazy developers – less rework, less delays = $$$
  • 26. dylan@pretaweb.comPloneConf 2009 Dylan Jay Credits http://docs.python.org/library/doctest.html http://pypi.python.org/pypi/zc.testbrowser http://plone.org/documentation/tutorial/testing/functional-tests