SlideShare a Scribd company logo
Getting started with
Testing
Adewale Andrade. 28/07/2017, Salvador, Bahia
WHY TEST?
○ Know that your code works…(and doesn’t
breaks anyone else’s).
○ Make deliveries and deploys more
stable….
○ Saves time (and pain) wasted on bug
fixing later…
○ Improving code designs and refactoring…
○ Reduce fear of failing...
TYPES OF TESTS (most common)
○ Unit Tests:
● Tests a small part of the application independently
from other parts; (Testing one class’s method);
○ Integration Test (Functional Tests):
● Tests different parts of the application working
together; (Testing a controller using multiple classes)
○ End-To-End Tests (E2E):
● Tests whether the flow of an application performs as
designed from start to finish; (Testing a login flow)
OUR STACK
○ PHPUnit
○ Neos Flow
○ PHP 5.5.9
○ Apache 2
OK… BUT…..
What are we really testing?
Test behaviour
Not implementation….
“When testing, face the code like a
complete stranger…
You have no idea how it does what
it should do…
But you know your expectations!
WHAT MAKES A GOOD UNIT TEST?
○ Unit tests should be:
● Easy to write;
● Easy to read;
● Fast;
● Not an integration test
■ No access to external resources (network,
databases, file systems, etc.)
A SIMPLE UNIT TEST
A SIMPLE INTEGRATION TEST
WHAT DO YOU NEED TO KNOW?
○ What are you testing?
○ How should it behave?
○ What are the edge cases?
○ Mapped entries?
○ Expected results?
OK… BUT…..
Does the code quality even
matter?
Getting started with unit and functional testing
THINGS TO AVOID
As much as possible!
NON-DETERMINISTIC FACTORS
INTERNAL DEPENDENCIES
WHEN TO USE EACH ONE
○ Unit Tests:
● Models
● Services methods that don’t have internal
dependencies;
○ Integration Tests:
● Controllers;
● Services;
● Repositories;
HANDLING DEPENDENCIES
○ Unit tests:
● Maybe you should
refactor it….
● Dependency
Injection;
● Mocking;
● Maybe it is an
integration test;
https://jtreminio.com/2013/03/unit-testing-tutorial-part-4-mock-objects-stub-methods-depen
dency-injection/
HANDLING DEPENDENCIES
○ Integration tests:
● Dependency
Injection;
● Mocking;
● Do not mock
things that you
are testing.
Show me the
code!
Finally… some action!
REINFORCING THE CULTURE
○ Pull Requests + Code Review
○ Continuous Integration Servers
● Coverage Tests
● Build Breaking and Notifying
○ Leading by example
Thanks ;)
“With faith, my brother”
Adewale Andrade
Software Engineer
@Agilize Contabilidade Online
adewale.andrade@gmail.com

More Related Content

What's hot (20)

PPTX
Obejct Oriented SCM - OOSCM
Hernan Wilkinson
 
PPTX
Mocking in python
Ooblioob
 
PPT
Nguyenvandungb seminar
dunglinh111
 
PPT
Testing And Drupal
Peter Arato
 
PDF
The art of being an agile programmer
Claudia Rosu
 
PDF
Effective Unit Testing
Eyal Kenig
 
PDF
Robot Framework Dos And Don'ts
Pekka Klärck
 
PPTX
What is stlc
Abdullah Al Rumy
 
PPT
8 - Javascript unit testing framework
Nguyen Duc Phu
 
PDF
Introduzione allo Unit Testing
Stefano Ottaviani
 
PDF
Practical pointers for better code review
khink
 
PDF
RoboCon 2018: How did we get here? Where do we go next?
Pekka Klärck
 
ODP
CLEAN CODE
Knoldus Inc.
 
PDF
Android Frameworks: Highlighting the Need for a Solid Development Framework 
Mutual Mobile
 
PDF
DrTests: The Future of Testing in Pharo
ESUG
 
PDF
Technical screening .Net Developer
Tom Henricksen
 
PDF
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
Iosif Itkin
 
PDF
Testing softvamp techno solutions technical interview questions for 1year exp...
SoftvampTechnoSoluti
 
PPTX
Effective Code Review
Eyal Kenig
 
ODP
Specifications pattern
Tung Nguyen
 
Obejct Oriented SCM - OOSCM
Hernan Wilkinson
 
Mocking in python
Ooblioob
 
Nguyenvandungb seminar
dunglinh111
 
Testing And Drupal
Peter Arato
 
The art of being an agile programmer
Claudia Rosu
 
Effective Unit Testing
Eyal Kenig
 
Robot Framework Dos And Don'ts
Pekka Klärck
 
What is stlc
Abdullah Al Rumy
 
8 - Javascript unit testing framework
Nguyen Duc Phu
 
Introduzione allo Unit Testing
Stefano Ottaviani
 
Practical pointers for better code review
khink
 
RoboCon 2018: How did we get here? Where do we go next?
Pekka Klärck
 
CLEAN CODE
Knoldus Inc.
 
Android Frameworks: Highlighting the Need for a Solid Development Framework 
Mutual Mobile
 
DrTests: The Future of Testing in Pharo
ESUG
 
Technical screening .Net Developer
Tom Henricksen
 
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
Iosif Itkin
 
Testing softvamp techno solutions technical interview questions for 1year exp...
SoftvampTechnoSoluti
 
Effective Code Review
Eyal Kenig
 
Specifications pattern
Tung Nguyen
 

Similar to Getting started with unit and functional testing (20)

PPTX
Unit Testing and TDD 2017
Xavi Hidalgo
 
PDF
Software Testing Basic Concepts
wesovi
 
PDF
Writing Tests Effectively
Paul Boocock
 
PDF
Test driven development
Sharafat Ibn Mollah Mosharraf
 
PPTX
Unit testing
PiXeL16
 
PDF
TDD in Python With Pytest
Eddy Reyes
 
PDF
Unit testing (Exploring the other side as a tester)
Abhijeet Vaikar
 
PDF
Test driven development - Zombie proof your code
Pascal Larocque
 
PDF
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
Adam Doyle
 
PDF
Working With Legacy Code
Andrea Polci
 
PDF
Introduzione a junit + integrazione con archibus
Davide Fella
 
PDF
Introduction to Continuous Delivery
Giovanni Toraldo
 
PDF
Writing Tests with the Unity Test Framework
Peter Kofler
 
PPTX
Project Onion unit test environment
Abhinav Jha
 
PPTX
Selenium done right
Tal Landa
 
PDF
Session on Testing Activities in Continuous Integration and Delivery as an Ex...
Agile Testing Alliance
 
PPTX
Testing activities in continuous integration and continuous delivery as an ex...
Srinivas Kadiyala
 
PDF
Testing activities in CI/CD as exploratory tester
Srinivas Kadiyala
 
PPT
Software testing and software development process
Gen Aloys Ochola Badde
 
PDF
Test-Driven Development (TDD) in Swift
Amey Tavkar
 
Unit Testing and TDD 2017
Xavi Hidalgo
 
Software Testing Basic Concepts
wesovi
 
Writing Tests Effectively
Paul Boocock
 
Test driven development
Sharafat Ibn Mollah Mosharraf
 
Unit testing
PiXeL16
 
TDD in Python With Pytest
Eddy Reyes
 
Unit testing (Exploring the other side as a tester)
Abhijeet Vaikar
 
Test driven development - Zombie proof your code
Pascal Larocque
 
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
Adam Doyle
 
Working With Legacy Code
Andrea Polci
 
Introduzione a junit + integrazione con archibus
Davide Fella
 
Introduction to Continuous Delivery
Giovanni Toraldo
 
Writing Tests with the Unity Test Framework
Peter Kofler
 
Project Onion unit test environment
Abhinav Jha
 
Selenium done right
Tal Landa
 
Session on Testing Activities in Continuous Integration and Delivery as an Ex...
Agile Testing Alliance
 
Testing activities in continuous integration and continuous delivery as an ex...
Srinivas Kadiyala
 
Testing activities in CI/CD as exploratory tester
Srinivas Kadiyala
 
Software testing and software development process
Gen Aloys Ochola Badde
 
Test-Driven Development (TDD) in Swift
Amey Tavkar
 
Ad

Recently uploaded (20)

PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Ad

Getting started with unit and functional testing

  • 1. Getting started with Testing Adewale Andrade. 28/07/2017, Salvador, Bahia
  • 2. WHY TEST? ○ Know that your code works…(and doesn’t breaks anyone else’s). ○ Make deliveries and deploys more stable…. ○ Saves time (and pain) wasted on bug fixing later… ○ Improving code designs and refactoring… ○ Reduce fear of failing...
  • 3. TYPES OF TESTS (most common) ○ Unit Tests: ● Tests a small part of the application independently from other parts; (Testing one class’s method); ○ Integration Test (Functional Tests): ● Tests different parts of the application working together; (Testing a controller using multiple classes) ○ End-To-End Tests (E2E): ● Tests whether the flow of an application performs as designed from start to finish; (Testing a login flow)
  • 4. OUR STACK ○ PHPUnit ○ Neos Flow ○ PHP 5.5.9 ○ Apache 2
  • 5. OK… BUT….. What are we really testing?
  • 7. “When testing, face the code like a complete stranger… You have no idea how it does what it should do… But you know your expectations!
  • 8. WHAT MAKES A GOOD UNIT TEST? ○ Unit tests should be: ● Easy to write; ● Easy to read; ● Fast; ● Not an integration test ■ No access to external resources (network, databases, file systems, etc.)
  • 11. WHAT DO YOU NEED TO KNOW? ○ What are you testing? ○ How should it behave? ○ What are the edge cases? ○ Mapped entries? ○ Expected results?
  • 12. OK… BUT….. Does the code quality even matter?
  • 14. THINGS TO AVOID As much as possible!
  • 17. WHEN TO USE EACH ONE ○ Unit Tests: ● Models ● Services methods that don’t have internal dependencies; ○ Integration Tests: ● Controllers; ● Services; ● Repositories;
  • 18. HANDLING DEPENDENCIES ○ Unit tests: ● Maybe you should refactor it…. ● Dependency Injection; ● Mocking; ● Maybe it is an integration test; https://jtreminio.com/2013/03/unit-testing-tutorial-part-4-mock-objects-stub-methods-depen dency-injection/
  • 19. HANDLING DEPENDENCIES ○ Integration tests: ● Dependency Injection; ● Mocking; ● Do not mock things that you are testing.
  • 21. REINFORCING THE CULTURE ○ Pull Requests + Code Review ○ Continuous Integration Servers ● Coverage Tests ● Build Breaking and Notifying ○ Leading by example
  • 22. Thanks ;) “With faith, my brother” Adewale Andrade Software Engineer @Agilize Contabilidade Online [email protected]