SlideShare a Scribd company logo
1 of 23
Regression Testing with Symfony
Tools and techniques for building your test suite
Introducing the speaker




              Joachim Unger
              @joeywannabe


              Symfony Explorer since 2.0
              Web Developer since 2010
              Former scientist at ABB Robotics


              Software Developer @LittleBird GmbH
              Berlin
Part 1: Exploring the techiques

   Regression Testing
   Test granularities in web projects
   Basic design patterns
   Symfony test components
   Behaviour Driven Development
   Continuous Integration
   Lessons learned
Regression Tests

   Discover new software bugs (regression)
   Verify bugfixes on existing functionality
   Validate changes against other components
   Include rerunning previously run tests
   Run on each code change
   Ensure product quality
   Minimize risks
Types of Regression Tests

 Progressive Regression Tests
    Specification has changed
    Code has been changed
      > Add new test cases
 Correcting Regression Tests
    Specification has not changed
    Test code changes against existing test cases
Regression Tests in web projects

 Defined test strategy
 Test-Driven Programming
   Tests for all code changes (e.g. bugfixes)
   Tests have to be up-to-date
   Continuous Refactoring
 Automated Test Suite
   Run on each code change
   Smoke, Acceptance and Unit Tests
   Continuous Integration
Software Quality


                         Functional Quality
                            Error-free execution of application
                            Strongly influences user acceptance
  Browser

                         Structural Quality
 Controller   View          Design and structure of code
              Utility       Loose coupling of components
                            Ensures extensibility of code
  Model
 ORM/DBAL
Unit Tests



    Assert that the result of
    foobar(“foo“) is “bar“.



   Verify functionality of single component
   Allow safe refactoring of code parts
   Must run successfully on each change
   Test is written with/before code
Acceptance Tests




                              Check that a click on button
                          „Put on shopping cart“ puts the item
                                 into the shopping cart

   Verify the functional requirements
   Ensure the overall application usability
   Test specification provided by stakeholder
Smoke Tests




                  Check that the url of a product page
                    is really showing a product page


 Verify the overall application functionality
 Good to identify crucial bugs
Separation Of Concerns

 Separation of task in independent blocks
    Loose coupling between components
    Heavy use of dependency injection

  Browser
                          MVC as an example
                             Model: Exchange and storage of data
                             View: Representaton of data
  Controller   View
                             Controller: Application Logic
               Utility


   Model
                          Decoupling of unit tests
 ORM/DBAL
Inversion Of Control

 Removal of static assignments
   Framework only works with abstraction of components
   Object graph is instantiated dynamically
 Separation of execution and implementation
Unit Testing in PHP

 phpunit: Status quo for testing in PHP
    Created by Sebastian Bergmann
    Originated as port of Junit
    Supports various features / extensions
 Framework for embedding tests in application
    Execution as test suite for an project
    Mocking of injected objects
    Code & coverage analysis
 Various functions for test assertions
Test Components in Symfony

 Unit Tests
     Enforce usage of dependency injection
     Testing of DBAL, model and relations
     Testing of components, utility classes
     Mocking of dependencies
 Functional Tests
   Testing page reachability
   Testing of page content and links
   Easy utilization for smoke tests
  http://symfony.com/doc/current/book/testing.html
Behaviour Driven Development

   Enhancement to Test-Driven Development
   Introduced by Dan North in 2006
   Tests act as functional specification
   Missing link between developer and stakeholder
       Justify functional requirements at beginning
       Software developed against functional specification
       Specified in a formal language (no experts needed)
       Clear focus on functionality
BDD Test Specification


    Scenario: Put item in shopping cart
    Given the case, the customer wants to buy a movie
       And his shopping cart is empty
       And there are 2 movies in stock
    When he puts the item in the shopping cart
    Then the item should show up in the shopping cart
       And the shopping cart counter should show 1
       And 1 movie should be in stock
BDD Testing Bundles



 Behat
 Bundle
            Integration of Behat into Symfony

  Mink
 Bundle     Integration of Mink into Symfony

 Behat      Test Engine for executing Gherking test case

  Mink      Encapsulation of different browser drivers
  Gherkin   Formal language to describe test cases
Other Testing Bundles

 DoctrineFixturesBundle
   Preparation of test data sets
 LiipFunctionalTestBundle
   Simplifies preparation and execution
   Utilizes DoctrineFixturesBundle
 PSSMockeryBundle (Symfony2MockerExtension)
   Mocking of services in DIC
   Demarcation of tests
Continuous Integration

 Continuous process to apply quality control
 Various CI Systems available
    Bamboo, Jenkins, CruiseControl
 Successfull development process for CI
      Direct feedback -> Short execution times
      Frequent checkins
      Commits to trunk
      Automated test chain
      Automated deploy -> Continuous delivery
Continuous Integration




                                             Automated Build
                                                Smoke Tests
                                                Unit Tests
                 Periodical Build
                                                Syntax Tests
                    Smoke Tests                Coding Standards
                    Unit Tests                 Copy/Paste Detection
                    Syntax Tests               Documentation
                    Coding Standards
                    Copy/Paste Detection
                    Documentation
                 +   Acceptance Tests
                 +   Other intensive tests
Favoured Test Suite

 Test-Driven Development
    Testing influences whole development process
    Loose coupling of components
 Test chain according to granularities
      Smoke Tests: Routes, Firewalls (Reachability)
      Unit Tests: Modular components, Utility classes
      DBAL Tests: Entity, Relations and Repository
      BDD Tests: User Interface (Usability)
 Continuous Integration System
    Triggers test chain on each commit
    Verifies state before final deploy
Lessons learned

   Commitment to TDD needed
   Testing influences software design
   Testing takes its time
   Quality can hardly be achieved later on
   Full test coverage almost unachievable
   Regression tests need automated test suite
   Testing only way to ensure software quality
Questions



            Questions regarding the practical
            usage probably covered in part 2

More Related Content

What's hot

Continuous Integration to Shift Left Testing Across the Enterprise Stack
Continuous Integration to Shift Left Testing Across the Enterprise StackContinuous Integration to Shift Left Testing Across the Enterprise Stack
Continuous Integration to Shift Left Testing Across the Enterprise StackDevOps.com
 
Software testing tools (free and open source)
Software testing tools (free and open source)Software testing tools (free and open source)
Software testing tools (free and open source)Wael Mansour
 
Rational Functional Tester
Rational Functional TesterRational Functional Tester
Rational Functional TesterRavi Anand
 
Programming skills for test automation
Programming skills for test automationProgramming skills for test automation
Programming skills for test automationRomania Testing
 
Practical unit testing in c & c++
Practical unit testing in c & c++Practical unit testing in c & c++
Practical unit testing in c & c++Matt Hargett
 
Testing Tool Evaluation Criteria
Testing Tool Evaluation CriteriaTesting Tool Evaluation Criteria
Testing Tool Evaluation Criteriabasma_iti_1984
 
Practical Software Testing Tools
Practical Software Testing ToolsPractical Software Testing Tools
Practical Software Testing ToolsDr Ganesh Iyer
 
Introduction to Gauge
Introduction to GaugeIntroduction to Gauge
Introduction to Gaugevodqancr
 
Test automation lessons from WebSphere Application Server
Test automation lessons from WebSphere Application ServerTest automation lessons from WebSphere Application Server
Test automation lessons from WebSphere Application ServerRobbie Minshall
 
Integrate UFT with Jenkins Guide
Integrate UFT with Jenkins GuideIntegrate UFT with Jenkins Guide
Integrate UFT with Jenkins GuideYu Tao Zhang
 
Automation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional TesterAutomation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional TesterVijayChowthri Nagaprakasham
 
Keyword Driven Automation
Keyword Driven AutomationKeyword Driven Automation
Keyword Driven AutomationPankaj Goel
 
An exploratory study of the state of practice of performance testing in Java-...
An exploratory study of the state of practice of performance testing in Java-...An exploratory study of the state of practice of performance testing in Java-...
An exploratory study of the state of practice of performance testing in Java-...corpaulbezemer
 
Software+struc+doc
Software+struc+docSoftware+struc+doc
Software+struc+docG.C Reddy
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software TestingMohammed Moishin
 

What's hot (17)

Continuous Integration to Shift Left Testing Across the Enterprise Stack
Continuous Integration to Shift Left Testing Across the Enterprise StackContinuous Integration to Shift Left Testing Across the Enterprise Stack
Continuous Integration to Shift Left Testing Across the Enterprise Stack
 
Software testing tools (free and open source)
Software testing tools (free and open source)Software testing tools (free and open source)
Software testing tools (free and open source)
 
Rational Functional Tester
Rational Functional TesterRational Functional Tester
Rational Functional Tester
 
Programming skills for test automation
Programming skills for test automationProgramming skills for test automation
Programming skills for test automation
 
Practical unit testing in c & c++
Practical unit testing in c & c++Practical unit testing in c & c++
Practical unit testing in c & c++
 
Testing Tool Evaluation Criteria
Testing Tool Evaluation CriteriaTesting Tool Evaluation Criteria
Testing Tool Evaluation Criteria
 
Testing
TestingTesting
Testing
 
Agile test practices
Agile test practicesAgile test practices
Agile test practices
 
Practical Software Testing Tools
Practical Software Testing ToolsPractical Software Testing Tools
Practical Software Testing Tools
 
Introduction to Gauge
Introduction to GaugeIntroduction to Gauge
Introduction to Gauge
 
Test automation lessons from WebSphere Application Server
Test automation lessons from WebSphere Application ServerTest automation lessons from WebSphere Application Server
Test automation lessons from WebSphere Application Server
 
Integrate UFT with Jenkins Guide
Integrate UFT with Jenkins GuideIntegrate UFT with Jenkins Guide
Integrate UFT with Jenkins Guide
 
Automation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional TesterAutomation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional Tester
 
Keyword Driven Automation
Keyword Driven AutomationKeyword Driven Automation
Keyword Driven Automation
 
An exploratory study of the state of practice of performance testing in Java-...
An exploratory study of the state of practice of performance testing in Java-...An exploratory study of the state of practice of performance testing in Java-...
An exploratory study of the state of practice of performance testing in Java-...
 
Software+struc+doc
Software+struc+docSoftware+struc+doc
Software+struc+doc
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
 

Similar to Regression Testing with Symfony

Model For Applying Unit Test
Model For Applying Unit TestModel For Applying Unit Test
Model For Applying Unit TestHieu Le Trung
 
Automated testing - how?
Automated testing - how?Automated testing - how?
Automated testing - how?Markko Paas
 
03 test specification and execution
03   test specification and execution03   test specification and execution
03 test specification and executionClemens Reijnen
 
Back to basics - PHPUnit
Back to basics - PHPUnitBack to basics - PHPUnit
Back to basics - PHPUnitSebastian Marek
 
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...Mohammed Kharma-A flexible framework for quality assurance and testing of sof...
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...Mohammed Kharma
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD123abcda
 
Unit testing
Unit testing Unit testing
Unit testing dubbu
 
Microsoft Stack Visual Studio 2010 Overview
Microsoft  Stack   Visual Studio 2010 OverviewMicrosoft  Stack   Visual Studio 2010 Overview
Microsoft Stack Visual Studio 2010 Overviewrfennell
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated TestingLee Englestone
 
Neil Tompson - SoftTest Ireland
Neil Tompson - SoftTest IrelandNeil Tompson - SoftTest Ireland
Neil Tompson - SoftTest IrelandDavid O'Dowd
 
Manual Testing Questions
Manual Testing QuestionsManual Testing Questions
Manual Testing QuestionsUser1test
 
Glossary of Testing Terms and Concepts
Glossary of Testing Terms and ConceptsGlossary of Testing Terms and Concepts
Glossary of Testing Terms and Conceptsmqamarhayat
 
Automated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS SitesAutomated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS Sitesjoelabrahamsson
 
Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Mohamed Taman
 
Testy dymne, integracyjne i jednostkowe w Laravel
Testy dymne, integracyjne i jednostkowe w LaravelTesty dymne, integracyjne i jednostkowe w Laravel
Testy dymne, integracyjne i jednostkowe w LaravelLaravel Poland MeetUp
 

Similar to Regression Testing with Symfony (20)

Model For Applying Unit Test
Model For Applying Unit TestModel For Applying Unit Test
Model For Applying Unit Test
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Automated testing - how?
Automated testing - how?Automated testing - how?
Automated testing - how?
 
03 test specification and execution
03   test specification and execution03   test specification and execution
03 test specification and execution
 
Back to basics - PHPUnit
Back to basics - PHPUnitBack to basics - PHPUnit
Back to basics - PHPUnit
 
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...Mohammed Kharma-A flexible framework for quality assurance and testing of sof...
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD
 
Unit testing
Unit testing Unit testing
Unit testing
 
Testing strategies
Testing strategiesTesting strategies
Testing strategies
 
Microsoft Stack Visual Studio 2010 Overview
Microsoft  Stack   Visual Studio 2010 OverviewMicrosoft  Stack   Visual Studio 2010 Overview
Microsoft Stack Visual Studio 2010 Overview
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated Testing
 
Neil Tompson - SoftTest Ireland
Neil Tompson - SoftTest IrelandNeil Tompson - SoftTest Ireland
Neil Tompson - SoftTest Ireland
 
Manual Testing Questions
Manual Testing QuestionsManual Testing Questions
Manual Testing Questions
 
Glossary of Testing Terms and Concepts
Glossary of Testing Terms and ConceptsGlossary of Testing Terms and Concepts
Glossary of Testing Terms and Concepts
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Automated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS SitesAutomated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS Sites
 
Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.
 
Testy dymne, integracyjne i jednostkowe w Laravel
Testy dymne, integracyjne i jednostkowe w LaravelTesty dymne, integracyjne i jednostkowe w Laravel
Testy dymne, integracyjne i jednostkowe w Laravel
 
Testing concepts
Testing conceptsTesting concepts
Testing concepts
 

Recently uploaded

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Recently uploaded (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Regression Testing with Symfony

  • 1. Regression Testing with Symfony Tools and techniques for building your test suite
  • 2. Introducing the speaker Joachim Unger @joeywannabe Symfony Explorer since 2.0 Web Developer since 2010 Former scientist at ABB Robotics Software Developer @LittleBird GmbH Berlin
  • 3. Part 1: Exploring the techiques  Regression Testing  Test granularities in web projects  Basic design patterns  Symfony test components  Behaviour Driven Development  Continuous Integration  Lessons learned
  • 4. Regression Tests  Discover new software bugs (regression)  Verify bugfixes on existing functionality  Validate changes against other components  Include rerunning previously run tests  Run on each code change  Ensure product quality  Minimize risks
  • 5. Types of Regression Tests  Progressive Regression Tests  Specification has changed  Code has been changed > Add new test cases  Correcting Regression Tests  Specification has not changed  Test code changes against existing test cases
  • 6. Regression Tests in web projects  Defined test strategy  Test-Driven Programming  Tests for all code changes (e.g. bugfixes)  Tests have to be up-to-date  Continuous Refactoring  Automated Test Suite  Run on each code change  Smoke, Acceptance and Unit Tests  Continuous Integration
  • 7. Software Quality  Functional Quality  Error-free execution of application  Strongly influences user acceptance Browser  Structural Quality Controller View  Design and structure of code Utility  Loose coupling of components  Ensures extensibility of code Model ORM/DBAL
  • 8. Unit Tests Assert that the result of foobar(“foo“) is “bar“.  Verify functionality of single component  Allow safe refactoring of code parts  Must run successfully on each change  Test is written with/before code
  • 9. Acceptance Tests Check that a click on button „Put on shopping cart“ puts the item into the shopping cart  Verify the functional requirements  Ensure the overall application usability  Test specification provided by stakeholder
  • 10. Smoke Tests Check that the url of a product page is really showing a product page  Verify the overall application functionality  Good to identify crucial bugs
  • 11. Separation Of Concerns  Separation of task in independent blocks  Loose coupling between components  Heavy use of dependency injection Browser  MVC as an example  Model: Exchange and storage of data  View: Representaton of data Controller View  Controller: Application Logic Utility Model  Decoupling of unit tests ORM/DBAL
  • 12. Inversion Of Control  Removal of static assignments  Framework only works with abstraction of components  Object graph is instantiated dynamically  Separation of execution and implementation
  • 13. Unit Testing in PHP  phpunit: Status quo for testing in PHP  Created by Sebastian Bergmann  Originated as port of Junit  Supports various features / extensions  Framework for embedding tests in application  Execution as test suite for an project  Mocking of injected objects  Code & coverage analysis  Various functions for test assertions
  • 14. Test Components in Symfony  Unit Tests  Enforce usage of dependency injection  Testing of DBAL, model and relations  Testing of components, utility classes  Mocking of dependencies  Functional Tests  Testing page reachability  Testing of page content and links  Easy utilization for smoke tests http://symfony.com/doc/current/book/testing.html
  • 15. Behaviour Driven Development  Enhancement to Test-Driven Development  Introduced by Dan North in 2006  Tests act as functional specification  Missing link between developer and stakeholder  Justify functional requirements at beginning  Software developed against functional specification  Specified in a formal language (no experts needed)  Clear focus on functionality
  • 16. BDD Test Specification Scenario: Put item in shopping cart Given the case, the customer wants to buy a movie And his shopping cart is empty And there are 2 movies in stock When he puts the item in the shopping cart Then the item should show up in the shopping cart And the shopping cart counter should show 1 And 1 movie should be in stock
  • 17. BDD Testing Bundles Behat Bundle Integration of Behat into Symfony Mink Bundle Integration of Mink into Symfony Behat Test Engine for executing Gherking test case Mink Encapsulation of different browser drivers Gherkin Formal language to describe test cases
  • 18. Other Testing Bundles  DoctrineFixturesBundle  Preparation of test data sets  LiipFunctionalTestBundle  Simplifies preparation and execution  Utilizes DoctrineFixturesBundle  PSSMockeryBundle (Symfony2MockerExtension)  Mocking of services in DIC  Demarcation of tests
  • 19. Continuous Integration  Continuous process to apply quality control  Various CI Systems available  Bamboo, Jenkins, CruiseControl  Successfull development process for CI  Direct feedback -> Short execution times  Frequent checkins  Commits to trunk  Automated test chain  Automated deploy -> Continuous delivery
  • 20. Continuous Integration Automated Build  Smoke Tests  Unit Tests Periodical Build  Syntax Tests  Smoke Tests  Coding Standards  Unit Tests  Copy/Paste Detection  Syntax Tests  Documentation  Coding Standards  Copy/Paste Detection  Documentation + Acceptance Tests + Other intensive tests
  • 21. Favoured Test Suite  Test-Driven Development  Testing influences whole development process  Loose coupling of components  Test chain according to granularities  Smoke Tests: Routes, Firewalls (Reachability)  Unit Tests: Modular components, Utility classes  DBAL Tests: Entity, Relations and Repository  BDD Tests: User Interface (Usability)  Continuous Integration System  Triggers test chain on each commit  Verifies state before final deploy
  • 22. Lessons learned  Commitment to TDD needed  Testing influences software design  Testing takes its time  Quality can hardly be achieved later on  Full test coverage almost unachievable  Regression tests need automated test suite  Testing only way to ensure software quality
  • 23. Questions Questions regarding the practical usage probably covered in part 2