SlideShare a Scribd company logo
1 of 31
Download to read offline
Functional  
Testing  Pa0erns	
    Premanand Chandrasekaran
        ThoughtWorks, Inc.
   premanand@thoughtworks.com
Types  of  Tests	
                                                     Business  Facing	
Support  Programming	




                                   Functional  Tests	
                 Showcases	
                                   Acceptance  Tests	
                 Exploratory  Tests	




                                                                                                     Critique  Product	
                                                                       Usability  Tests	




                                   Unit  Tests	
                       Performance  Tests	
                                   Component  Tests	
                  Stress  Tests	
                                   System  Tests	
                     Security  Tests	


                                                    Technology  Facing	

                         h0p://www.exampler.com/old-­‐‑blog/2003/08/21/#agile-­‐‑testing-­‐‑project-­‐‑1	
© 2012 ThoughtWorks, Inc.                                                                                                  2
Functional  Tests  -­‐‑  The  Pitch	
•  What Are Functional Tests?
   o Verification that business requirements are
     met
   o Black Box
   o Automated
•  Why Functional Tests?
   o Maintain (high) external quality
   o Allow team to be bolder
   o Allow team to go faster

© 2012 ThoughtWorks, Inc.                          3
Functional  Tests  –  The  Reality	
•  Flaky
•  Take long time to run
•  Cumbersome to maintain
•  Don’t catch many bugs
•  Some things are hard to automate
•  Don’t quite give you the feedback
   you were hoping for
© 2012 ThoughtWorks, Inc.          4
Consequences	
•  Low confidence in automation
•  Over-reliance on manual testing




•  Slipped Deadlines AND/OR
•  Lesser Testing AND/OR
•  Testing in Production :-)

© 2012 ThoughtWorks, Inc.              5
How  To  Get  Be0er?	
                                        Technology	




                            Process	




                                                   People	




© 2012 ThoughtWorks, Inc.                                     6
Process	



© 2012 ThoughtWorks, Inc.               7
Functional  Test  –  Example	



© 2012 ThoughtWorks, Inc.   8
Example  -­‐‑  Specification	




© 2012 ThoughtWorks, Inc.                   9
Example  –  Implementation	




© 2012 ThoughtWorks, Inc.                10
Implementation  Problems?	
•  No correlation between specification
   and implementation
•  Intent lost in translation
•  Easy to write, hard to read, maintain
•  Too monolithic, lacks abstraction

•  Causes non-technical domain experts
   to tune out of the process
© 2012 ThoughtWorks, Inc.                  11
Executable  Specifications	
   Specification  Step	
                                                                                    
                                                                              	



                                                                     Tight  Correlation	
Implementation  Step	
                                                                         
                                                                   	




  © 2012 ThoughtWorks, Inc.                                                                 12
Functional  Test  -­‐‑  Specification	




© 2012 ThoughtWorks, Inc.              13
More  useful  information	
        in  failure  reports	




© 2012 ThoughtWorks, Inc.             14
Acceptance  Criteria  DSL	
•      Given some initial context
•      When an event occurs
•      Then ensure outcome
•      Example –




     © 2012 ThoughtWorks, Inc.      15
Functional  Test  –  New  Implementation	




© 2012 ThoughtWorks, Inc.               16
Good  Acceptance  Criteria	
Scenario: Advanced Search for a hat!
!
Given I am searching on "http://www.etsy.com"!
When I click on the select box with css class "select.handmade"!
And I select "Knitting"!
And I click on the text box with id "#search_query"!
And type in "hat"!
Then there are search results!
	
                                   Focus  on  WHAT,  not  HOW	

          Scenario: Advanced Search for a hat!
          !
          Given I am searching on Etsy.com!
          And I am not logged in!
          And I specify the Knitting sub category!
          And I search for hat!                       Be@er	
          Then there are search results!
          !
    © 2012 ThoughtWorks, Inc.                                   17
How  Many  Tests?	
                                  Manual  Testing	


                                                                          10%	
                                    Functional	
                                      Tests	


                                Integration  Tests	
                      20%	




                                    Unit  Tests	
                         70%	



             h0p://blog.mountaingoatsoftware.com/tag/agile-­‐‑testing	
© 2012 ThoughtWorks, Inc.                                                  18
What  About  Legacy  Systems?	
•  Start with functional tests
•  Cover with unit tests for new
   functionality
•  Be on the lookout to replace
   functional tests more fine-grained tests
   at every given opportunity



© 2012 ThoughtWorks, Inc.                     19
What  To  Automate?	
•  The MOST important scenarios
   o  End-To-End system level scenarios
   o  Happy paths


•  Avoid automating individual feature-
   level acceptance criteria
•  Make a distinction between
   “ephemeral” and “long-standing”
   tests
© 2012 ThoughtWorks, Inc.                 20
When  do  these  tests  run?	
•  After every check-in

•  As part of CI build pipeline
   o Unit à Smoke à Regression à Deploy


•  Incubator Test Suites

© 2012 ThoughtWorks, Inc.                    21
Workflow	
•  Sprint [N -1]
    o  Feature elaboration with entry level acceptance criteria


•  Sprint [N]
    o  Feature kick-off meeting
    o  Developers implement feature
    o  Testers (optionally) add additional acceptance criteria


•  Sprint[N, N + 1]
    o  Testers verify all acceptance criteria to be satisfied
    o  Testers refactor functional test suite
    o  Feature marked complete

 © 2012 ThoughtWorks, Inc.                                        22
Technology	




© 2012 ThoughtWorks, Inc.                  23
Test  Characteristics	
•  Be idempotent
    o  At least re-runnable
    o  Keep tests isolated from one another
•  Be runnable in parallel
    o  No inter-dependencies between tests
•  Be deterministic
    o  Quarantine/eradicate non-deterministic tests
    o  Don’t “sleep”
          •  Prefer callbacks or at least poll for asynchronous responses
    o  Consider mocking remote third-party services
          •  Have separate tests to verify interaction with remote services
    o  Consider using relative dates/times or mock the system clock
    o  http://martinfowler.com/articles/nonDeterminism.html


 © 2012 ThoughtWorks, Inc.                                                    24
Test  Sources	
•  Don’t have any dependencies on
   production sources
•  Treat as first-class citizens
   o  Keep DRY
   o  Run static analysis metrics
•  Leverage design patterns like
   o  Page Objects
   o  Compound Steps
•  Consider the use of terser languages
   o  Groovy, Ruby etc.

© 2012 ThoughtWorks, Inc.                     25
Test  Data	
•  Use application to create test data
•  Use test data creation steps
   o  Frameworks like DBUnit
•  Use anonymized production data subsets
   o  Requires lot of time and effort
•  Use anonymized production data copies
   o  Huge data volumes may make it prohibitive
•  Avoid the shared database anti-pattern
•  Consider mocking remote third-party
   services
© 2012 ThoughtWorks, Inc.                         26
Test  Infrastructure	
•  Invest in fast build hardware
   o  CI servers support multiple remote agents

•  Use same software configuration as
   production in all environments
•  Consider running tests on the cloud
   o  http://www.saucelabs.com




© 2012 ThoughtWorks, Inc.                         27
People	


© 2012 ThoughtWorks, Inc.              28
Who  Writes/Owns  The  Tests?	
•  The specifications – acceptance
   criteria?
   o  Domain Experts
•  Step implementations?
   o  Developers & Testers


•  The functional suite?
   o  The Team
   o  Day-to-Day – Testers

© 2012 ThoughtWorks, Inc.            29
Team  Dynamics	
•  Fix broken builds and tests immediately
   o  OK to occasionally break the build
   o  Not OK to leave the build broken for long


•  Do not allow check-ins over a broken build
   o  Unless check-in is being made to fix the build


•  Co-locate teams as much as possible
   o  At least create fully formed remote teams

© 2012 ThoughtWorks, Inc.                              30
Questions?	

         premanand@thoughtworks.com


                            Thank You!


© 2012 ThoughtWorks, Inc.                  31

More Related Content

What's hot

Software testing
Software testingSoftware testing
Software testingAshu Bansal
 
Interview questions for manual testing technology.
Interview questions for manual testing technology.Interview questions for manual testing technology.
Interview questions for manual testing technology.Vinay Agnihotri
 
Software Testing Life Cycle – A Beginner’s Guide
Software Testing Life Cycle – A Beginner’s GuideSoftware Testing Life Cycle – A Beginner’s Guide
Software Testing Life Cycle – A Beginner’s GuideSyed Hassan Raza
 
Presentation On Software Testing Bug Life Cycle
Presentation On Software Testing Bug Life CyclePresentation On Software Testing Bug Life Cycle
Presentation On Software Testing Bug Life CycleRajon
 
Test Cases Maintaining & Documenting
Test Cases Maintaining & DocumentingTest Cases Maintaining & Documenting
Test Cases Maintaining & DocumentingSeyed Ali Marjaie
 
What Is Functional Testing?
What Is Functional Testing?What Is Functional Testing?
What Is Functional Testing?QA InfoTech
 
Smoke Testing
Smoke TestingSmoke Testing
Smoke TestingKanoah
 
Software Testing Process
Software Testing ProcessSoftware Testing Process
Software Testing Processguest1f2740
 
Automated Testing with Agile
Automated Testing with AgileAutomated Testing with Agile
Automated Testing with AgileKen McCorkell
 
Manual testing interview question by INFOTECH
Manual testing interview question by INFOTECHManual testing interview question by INFOTECH
Manual testing interview question by INFOTECHPravinsinh
 
powerpoint template for testing training
powerpoint template for testing trainingpowerpoint template for testing training
powerpoint template for testing trainingJohn Roddy
 
Software testing life cycle
Software testing life cycleSoftware testing life cycle
Software testing life cycleGaruda Trainings
 

What's hot (20)

Software testing
Software testingSoftware testing
Software testing
 
Interview questions for manual testing technology.
Interview questions for manual testing technology.Interview questions for manual testing technology.
Interview questions for manual testing technology.
 
Manual testing ppt
Manual testing pptManual testing ppt
Manual testing ppt
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Software Testing Life Cycle – A Beginner’s Guide
Software Testing Life Cycle – A Beginner’s GuideSoftware Testing Life Cycle – A Beginner’s Guide
Software Testing Life Cycle – A Beginner’s Guide
 
Presentation On Software Testing Bug Life Cycle
Presentation On Software Testing Bug Life CyclePresentation On Software Testing Bug Life Cycle
Presentation On Software Testing Bug Life Cycle
 
Types of testing
Types of testingTypes of testing
Types of testing
 
Stlc ppt
Stlc pptStlc ppt
Stlc ppt
 
Software testing
Software testingSoftware testing
Software testing
 
Test Cases Maintaining & Documenting
Test Cases Maintaining & DocumentingTest Cases Maintaining & Documenting
Test Cases Maintaining & Documenting
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 
What Is Functional Testing?
What Is Functional Testing?What Is Functional Testing?
What Is Functional Testing?
 
Smoke Testing
Smoke TestingSmoke Testing
Smoke Testing
 
Software Testing Process
Software Testing ProcessSoftware Testing Process
Software Testing Process
 
Automated Testing with Agile
Automated Testing with AgileAutomated Testing with Agile
Automated Testing with Agile
 
Manual testing interview question by INFOTECH
Manual testing interview question by INFOTECHManual testing interview question by INFOTECH
Manual testing interview question by INFOTECH
 
powerpoint template for testing training
powerpoint template for testing trainingpowerpoint template for testing training
powerpoint template for testing training
 
Software Testing or Quality Assurance
Software Testing or Quality AssuranceSoftware Testing or Quality Assurance
Software Testing or Quality Assurance
 
Software testing life cycle
Software testing life cycleSoftware testing life cycle
Software testing life cycle
 
Introduction & Manual Testing
Introduction & Manual TestingIntroduction & Manual Testing
Introduction & Manual Testing
 

Viewers also liked

Structural testing
Structural testingStructural testing
Structural testingSlideshare
 
Structural and functional testing
Structural and functional testingStructural and functional testing
Structural and functional testingHimanshu
 
GCSE ICT TESTING
GCSE ICT TESTING GCSE ICT TESTING
GCSE ICT TESTING morgan98
 
Effective Strategies for Distributed Testing
Effective Strategies for Distributed TestingEffective Strategies for Distributed Testing
Effective Strategies for Distributed TestingAnand Bagmar
 
Boundary value analysis
Boundary value analysisBoundary value analysis
Boundary value analysisVadym Muliavka
 
Introduzione al Testing
Introduzione al TestingIntroduzione al Testing
Introduzione al TestingDotNetMarche
 
Test Funzionale
Test FunzionaleTest Funzionale
Test FunzionaleIxmaSoft
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test PatternsFrank Appel
 
Design brief & specification
Design brief & specificationDesign brief & specification
Design brief & specificationhaobinliu
 
Teorie e tecniche dei test
Teorie e tecniche dei testTeorie e tecniche dei test
Teorie e tecniche dei testOlaudio Bia
 
Software Test Patterns: Successes and Challenges
Software Test Patterns: Successes and ChallengesSoftware Test Patterns: Successes and Challenges
Software Test Patterns: Successes and ChallengesBob Binder
 
Importance of software quality metrics
Importance of software quality metricsImportance of software quality metrics
Importance of software quality metricsPiyush Sohaney
 
Design patterns in web testing automation with WebDriver
Design patterns in web testing automation with WebDriverDesign patterns in web testing automation with WebDriver
Design patterns in web testing automation with WebDriverMikalai Alimenkou
 
Software Testing & Test Driven Development
Software Testing & Test Driven DevelopmentSoftware Testing & Test Driven Development
Software Testing & Test Driven DevelopmentSergio Santoro
 
Quality Metrics
Quality Metrics Quality Metrics
Quality Metrics Haroon Abbu
 
Test design techniques
Test design techniquesTest design techniques
Test design techniquesQA Guards
 

Viewers also liked (20)

Structural testing
Structural testingStructural testing
Structural testing
 
Structural and functional testing
Structural and functional testingStructural and functional testing
Structural and functional testing
 
GCSE ICT TESTING
GCSE ICT TESTING GCSE ICT TESTING
GCSE ICT TESTING
 
Effective Strategies for Distributed Testing
Effective Strategies for Distributed TestingEffective Strategies for Distributed Testing
Effective Strategies for Distributed Testing
 
Tw specifications for-testing1
Tw specifications for-testing1Tw specifications for-testing1
Tw specifications for-testing1
 
Boundary value analysis
Boundary value analysisBoundary value analysis
Boundary value analysis
 
Introduzione al Testing
Introduzione al TestingIntroduzione al Testing
Introduzione al Testing
 
Functional Programming in Java
Functional Programming in JavaFunctional Programming in Java
Functional Programming in Java
 
Test Funzionale
Test FunzionaleTest Funzionale
Test Funzionale
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test Patterns
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Design brief & specification
Design brief & specificationDesign brief & specification
Design brief & specification
 
Teorie e tecniche dei test
Teorie e tecniche dei testTeorie e tecniche dei test
Teorie e tecniche dei test
 
Software Test Patterns: Successes and Challenges
Software Test Patterns: Successes and ChallengesSoftware Test Patterns: Successes and Challenges
Software Test Patterns: Successes and Challenges
 
Importance of software quality metrics
Importance of software quality metricsImportance of software quality metrics
Importance of software quality metrics
 
Design patterns in web testing automation with WebDriver
Design patterns in web testing automation with WebDriverDesign patterns in web testing automation with WebDriver
Design patterns in web testing automation with WebDriver
 
Defect Life Cycle
Defect Life CycleDefect Life Cycle
Defect Life Cycle
 
Software Testing & Test Driven Development
Software Testing & Test Driven DevelopmentSoftware Testing & Test Driven Development
Software Testing & Test Driven Development
 
Quality Metrics
Quality Metrics Quality Metrics
Quality Metrics
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 

Similar to Functional testing patterns

QA Role In Agile Teams - by Michael Hall
QA Role In Agile Teams - by Michael HallQA Role In Agile Teams - by Michael Hall
QA Role In Agile Teams - by Michael HallSynerzip
 
How BDD enables True CI/CD
How BDD enables True CI/CDHow BDD enables True CI/CD
How BDD enables True CI/CDRoger Turnau
 
Testing on Android
Testing on AndroidTesting on Android
Testing on AndroidAri Lacenski
 
John Fodeh - Adventures in Test Automation-Breaking the Boundaries of Regress...
John Fodeh - Adventures in Test Automation-Breaking the Boundaries of Regress...John Fodeh - Adventures in Test Automation-Breaking the Boundaries of Regress...
John Fodeh - Adventures in Test Automation-Breaking the Boundaries of Regress...TEST Huddle
 
John Fodeh Adventures in Test Automation - EuroSTAR 2013
John Fodeh Adventures in Test Automation - EuroSTAR 2013John Fodeh Adventures in Test Automation - EuroSTAR 2013
John Fodeh Adventures in Test Automation - EuroSTAR 2013TEST Huddle
 
Testaus 2014 -seminaari: Paul Gerrard. The Changing Role of Testers’.
Testaus 2014 -seminaari: Paul Gerrard. The Changing Role of Testers’.Testaus 2014 -seminaari: Paul Gerrard. The Changing Role of Testers’.
Testaus 2014 -seminaari: Paul Gerrard. The Changing Role of Testers’.Tieturi Oy
 
Testaus 2014: Paul Gerrard - The Changing Role of Testers'
Testaus 2014: Paul Gerrard - The Changing Role of Testers'Testaus 2014: Paul Gerrard - The Changing Role of Testers'
Testaus 2014: Paul Gerrard - The Changing Role of Testers'Tieturi Oy
 
Requirements Engineering - The need for a solution - Marcel Overeem
Requirements Engineering - The need for a solution - Marcel OvereemRequirements Engineering - The need for a solution - Marcel Overeem
Requirements Engineering - The need for a solution - Marcel OvereemVisure Solutions
 
Paul Gerrard - The Redistribution of Testing – Where to Innovate and What to ...
Paul Gerrard - The Redistribution of Testing – Where to Innovate and What to ...Paul Gerrard - The Redistribution of Testing – Where to Innovate and What to ...
Paul Gerrard - The Redistribution of Testing – Where to Innovate and What to ...TEST Huddle
 
Презентация
ПрезентацияПрезентация
Презентацияguest22d71d
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven developmentEinar Ingebrigtsen
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnitsatejsahu
 
Test driven development v1.0
Test driven development v1.0Test driven development v1.0
Test driven development v1.0Ganesh Kondal
 
Automated Exploratory Tests
Automated Exploratory TestsAutomated Exploratory Tests
Automated Exploratory TestsZbyszek Mockun
 
STPCon fall 2012: The Testing Renaissance Has Arrived
STPCon fall 2012: The Testing Renaissance Has ArrivedSTPCon fall 2012: The Testing Renaissance Has Arrived
STPCon fall 2012: The Testing Renaissance Has ArrivedSOASTA
 

Similar to Functional testing patterns (20)

Agile testing
Agile testingAgile testing
Agile testing
 
Android testing
Android testingAndroid testing
Android testing
 
QA Role In Agile Teams - by Michael Hall
QA Role In Agile Teams - by Michael HallQA Role In Agile Teams - by Michael Hall
QA Role In Agile Teams - by Michael Hall
 
CNUG TDD June 2014
CNUG TDD June 2014CNUG TDD June 2014
CNUG TDD June 2014
 
How BDD enables True CI/CD
How BDD enables True CI/CDHow BDD enables True CI/CD
How BDD enables True CI/CD
 
Testing on Android
Testing on AndroidTesting on Android
Testing on Android
 
John Fodeh - Adventures in Test Automation-Breaking the Boundaries of Regress...
John Fodeh - Adventures in Test Automation-Breaking the Boundaries of Regress...John Fodeh - Adventures in Test Automation-Breaking the Boundaries of Regress...
John Fodeh - Adventures in Test Automation-Breaking the Boundaries of Regress...
 
John Fodeh Adventures in Test Automation - EuroSTAR 2013
John Fodeh Adventures in Test Automation - EuroSTAR 2013John Fodeh Adventures in Test Automation - EuroSTAR 2013
John Fodeh Adventures in Test Automation - EuroSTAR 2013
 
Testaus 2014 -seminaari: Paul Gerrard. The Changing Role of Testers’.
Testaus 2014 -seminaari: Paul Gerrard. The Changing Role of Testers’.Testaus 2014 -seminaari: Paul Gerrard. The Changing Role of Testers’.
Testaus 2014 -seminaari: Paul Gerrard. The Changing Role of Testers’.
 
Testaus 2014: Paul Gerrard - The Changing Role of Testers'
Testaus 2014: Paul Gerrard - The Changing Role of Testers'Testaus 2014: Paul Gerrard - The Changing Role of Testers'
Testaus 2014: Paul Gerrard - The Changing Role of Testers'
 
Requirements Engineering - The need for a solution - Marcel Overeem
Requirements Engineering - The need for a solution - Marcel OvereemRequirements Engineering - The need for a solution - Marcel Overeem
Requirements Engineering - The need for a solution - Marcel Overeem
 
Test Policy and Practices
Test Policy and PracticesTest Policy and Practices
Test Policy and Practices
 
Kku2011
Kku2011Kku2011
Kku2011
 
Paul Gerrard - The Redistribution of Testing – Where to Innovate and What to ...
Paul Gerrard - The Redistribution of Testing – Where to Innovate and What to ...Paul Gerrard - The Redistribution of Testing – Where to Innovate and What to ...
Paul Gerrard - The Redistribution of Testing – Where to Innovate and What to ...
 
Презентация
ПрезентацияПрезентация
Презентация
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnit
 
Test driven development v1.0
Test driven development v1.0Test driven development v1.0
Test driven development v1.0
 
Automated Exploratory Tests
Automated Exploratory TestsAutomated Exploratory Tests
Automated Exploratory Tests
 
STPCon fall 2012: The Testing Renaissance Has Arrived
STPCon fall 2012: The Testing Renaissance Has ArrivedSTPCon fall 2012: The Testing Renaissance Has Arrived
STPCon fall 2012: The Testing Renaissance Has Arrived
 

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 

Functional testing patterns

  • 1. Functional   Testing  Pa0erns Premanand Chandrasekaran ThoughtWorks, Inc. premanand@thoughtworks.com
  • 2. Types  of  Tests Business  Facing Support  Programming Functional  Tests Showcases Acceptance  Tests Exploratory  Tests Critique  Product Usability  Tests Unit  Tests Performance  Tests Component  Tests Stress  Tests System  Tests Security  Tests Technology  Facing h0p://www.exampler.com/old-­‐‑blog/2003/08/21/#agile-­‐‑testing-­‐‑project-­‐‑1 © 2012 ThoughtWorks, Inc. 2
  • 3. Functional  Tests  -­‐‑  The  Pitch •  What Are Functional Tests? o Verification that business requirements are met o Black Box o Automated •  Why Functional Tests? o Maintain (high) external quality o Allow team to be bolder o Allow team to go faster © 2012 ThoughtWorks, Inc. 3
  • 4. Functional  Tests  –  The  Reality •  Flaky •  Take long time to run •  Cumbersome to maintain •  Don’t catch many bugs •  Some things are hard to automate •  Don’t quite give you the feedback you were hoping for © 2012 ThoughtWorks, Inc. 4
  • 5. Consequences •  Low confidence in automation •  Over-reliance on manual testing •  Slipped Deadlines AND/OR •  Lesser Testing AND/OR •  Testing in Production :-) © 2012 ThoughtWorks, Inc. 5
  • 6. How  To  Get  Be0er? Technology Process People © 2012 ThoughtWorks, Inc. 6
  • 8. Functional  Test  –  Example © 2012 ThoughtWorks, Inc. 8
  • 9. Example  -­‐‑  Specification © 2012 ThoughtWorks, Inc. 9
  • 10. Example  –  Implementation © 2012 ThoughtWorks, Inc. 10
  • 11. Implementation  Problems? •  No correlation between specification and implementation •  Intent lost in translation •  Easy to write, hard to read, maintain •  Too monolithic, lacks abstraction •  Causes non-technical domain experts to tune out of the process © 2012 ThoughtWorks, Inc. 11
  • 12. Executable  Specifications Specification  Step                                                       Tight  Correlation Implementation  Step                                     © 2012 ThoughtWorks, Inc. 12
  • 13. Functional  Test  -­‐‑  Specification © 2012 ThoughtWorks, Inc. 13
  • 14. More  useful  information in  failure  reports © 2012 ThoughtWorks, Inc. 14
  • 15. Acceptance  Criteria  DSL •  Given some initial context •  When an event occurs •  Then ensure outcome •  Example – © 2012 ThoughtWorks, Inc. 15
  • 16. Functional  Test  –  New  Implementation © 2012 ThoughtWorks, Inc. 16
  • 17. Good  Acceptance  Criteria Scenario: Advanced Search for a hat! ! Given I am searching on "http://www.etsy.com"! When I click on the select box with css class "select.handmade"! And I select "Knitting"! And I click on the text box with id "#search_query"! And type in "hat"! Then there are search results! Focus  on  WHAT,  not  HOW Scenario: Advanced Search for a hat! ! Given I am searching on Etsy.com! And I am not logged in! And I specify the Knitting sub category! And I search for hat! Be@er Then there are search results! ! © 2012 ThoughtWorks, Inc. 17
  • 18. How  Many  Tests? Manual  Testing 10% Functional Tests Integration  Tests 20% Unit  Tests 70% h0p://blog.mountaingoatsoftware.com/tag/agile-­‐‑testing © 2012 ThoughtWorks, Inc. 18
  • 19. What  About  Legacy  Systems? •  Start with functional tests •  Cover with unit tests for new functionality •  Be on the lookout to replace functional tests more fine-grained tests at every given opportunity © 2012 ThoughtWorks, Inc. 19
  • 20. What  To  Automate? •  The MOST important scenarios o  End-To-End system level scenarios o  Happy paths •  Avoid automating individual feature- level acceptance criteria •  Make a distinction between “ephemeral” and “long-standing” tests © 2012 ThoughtWorks, Inc. 20
  • 21. When  do  these  tests  run? •  After every check-in •  As part of CI build pipeline o Unit à Smoke à Regression à Deploy •  Incubator Test Suites © 2012 ThoughtWorks, Inc. 21
  • 22. Workflow •  Sprint [N -1] o  Feature elaboration with entry level acceptance criteria •  Sprint [N] o  Feature kick-off meeting o  Developers implement feature o  Testers (optionally) add additional acceptance criteria •  Sprint[N, N + 1] o  Testers verify all acceptance criteria to be satisfied o  Testers refactor functional test suite o  Feature marked complete © 2012 ThoughtWorks, Inc. 22
  • 24. Test  Characteristics •  Be idempotent o  At least re-runnable o  Keep tests isolated from one another •  Be runnable in parallel o  No inter-dependencies between tests •  Be deterministic o  Quarantine/eradicate non-deterministic tests o  Don’t “sleep” •  Prefer callbacks or at least poll for asynchronous responses o  Consider mocking remote third-party services •  Have separate tests to verify interaction with remote services o  Consider using relative dates/times or mock the system clock o  http://martinfowler.com/articles/nonDeterminism.html © 2012 ThoughtWorks, Inc. 24
  • 25. Test  Sources •  Don’t have any dependencies on production sources •  Treat as first-class citizens o  Keep DRY o  Run static analysis metrics •  Leverage design patterns like o  Page Objects o  Compound Steps •  Consider the use of terser languages o  Groovy, Ruby etc. © 2012 ThoughtWorks, Inc. 25
  • 26. Test  Data •  Use application to create test data •  Use test data creation steps o  Frameworks like DBUnit •  Use anonymized production data subsets o  Requires lot of time and effort •  Use anonymized production data copies o  Huge data volumes may make it prohibitive •  Avoid the shared database anti-pattern •  Consider mocking remote third-party services © 2012 ThoughtWorks, Inc. 26
  • 27. Test  Infrastructure •  Invest in fast build hardware o  CI servers support multiple remote agents •  Use same software configuration as production in all environments •  Consider running tests on the cloud o  http://www.saucelabs.com © 2012 ThoughtWorks, Inc. 27
  • 29. Who  Writes/Owns  The  Tests? •  The specifications – acceptance criteria? o  Domain Experts •  Step implementations? o  Developers & Testers •  The functional suite? o  The Team o  Day-to-Day – Testers © 2012 ThoughtWorks, Inc. 29
  • 30. Team  Dynamics •  Fix broken builds and tests immediately o  OK to occasionally break the build o  Not OK to leave the build broken for long •  Do not allow check-ins over a broken build o  Unless check-in is being made to fix the build •  Co-locate teams as much as possible o  At least create fully formed remote teams © 2012 ThoughtWorks, Inc. 30
  • 31. Questions? premanand@thoughtworks.com Thank You! © 2012 ThoughtWorks, Inc. 31