SlideShare a Scribd company logo
Put an end to regression with
Codeception Testing
Joe Ferguson
Who Am I?
Joe Ferguson
PHP Developer
Engineer @ Aol.
Twitter: @JoePFerguson
Organizer of @MemphisPHP
OSMI Board Member
@NomadPHP Lightning Talks
Passionate about Community
Testing Resources
http://grumpy-learning.com
Assumptions
You know you need to write tests
You have written a test or two before
You might have even like writing tests
“There are no solutions,
only trade offs”
- Joe Ferguson
- Paul M. Jones
- Thomas Sowell
How is your test coverage?
Code Metrics
Code Climate - Grades your code quality
Coveralls - Shows what code is not covered
by your test suite
PHPUnit Code Coverage Analysis
When your app crashes
how hard does it crash?
“Can’t see the forest for the trees”
“Can’t see the forest for the trees”X X
App on Fire unit tests
^ ^
2 unit tests 0 integration tests
https://twitter.com/thepracticaldev/status/687672086152753152
2 unit tests 0 integration tests
2 unit tests 0 integration tests
https://twitter.com/ThePracticalDev/status/852508104914874369
Unit Tests ARE Important
Testing Trinity
Unit Tests - This method works
Functional Tests - This feature works
Acceptance Tests - This product works
Testing Trinity
Unit Tests - I know what broke
Functional Tests - Something Broke
Acceptance Tests - This product broke
Regression Testing
Regression Testing is Easy**
Bug Report Scenario
User reports that feature “Return Foo” always returns “Bar”
Create a test to ensure that feature “Return Foo” returns “Foo”
See test fails to confirm report or verify there is no bug
Correct your application logic and make your user happy
You should not run into
this bug again*
* If you do, you know because you have a test!
Put an end to regression with codeception testing
Install Codeception
Set Up Codeception
Codeception Files
Unit Test Suite
HomeController Foo Function
New Unit Test
./vendor/bin/codecept g:phpunit unit "AppHttpControllersHomeController"
HomeControllerTest.php
Write our test for foo()
Run our test
Run only unit tests
Later that week…
We caught the bug!
Customer Confidence++
I can do that with PHPUnit!
Functional Testing
This feature works
Functional Tests TL;DR
https://twitter.com/RebeccaSlatkin/status/852627030092939274
Baked in Functional Testing
Functional Test Suite
New Functional Test
./vendor/bin/codecept g:cept functional HomeController
Functional Test
HomeController.php
Test to verify we get redirected
Run our Functional Tests
Expand Our Test
Run our Functional Tests
Test Failure
Test Failure Output
What if something breaks?
Of course our test fails…
Browser Output on Failure
Acceptance Tests
This product works
PhantomJS
Acceptance Test Suite
New Acceptance Test
./vendor/bin/codecept g:cept acceptance RegisterCept
RegisterCept.php
Run Our Test
Run ALL the tests
There is not much difference between
functional and acceptance tests
Reuse Test Logic
Refactor RegisterCept.php
UserCanLoginCept.php
Run our tests
There is a problem with our
configuration of Codeception
Create a Clean DB Snapshot
codeception.yml
acceptance.suite.yml
Codecept Build
DB is cleaned
up after
Testing for Specific Content
Testing Navigation Clicks
Legacy Applications
Recap
Unit tests are important!
Use functional and acceptance suites to test operation of you
applications
Turn every bug report into a regression test so you’ll catch issues
faster
Too many regression tests? Could indicate workflow or UI/UX
issue in your application
Questions?
Feedback!
https://joind.in/talk/b7324
Joe Ferguson
Twitter: @JoePFerguson
Email: joe@joeferguson.me
Freenode: joepferguson
Contact Info:

More Related Content

PDF
Composer at Scale, Release and Dependency Management
PDF
Midwest PHP 2017 DevOps For Small team
PDF
So You Just Inherited a $Legacy Application...
PDF
Selenium conference, 2016
PPTX
Build 2017 - B8093 - Nextgen UWP app distribution: Building extensible, strea...
PDF
Speed up your Titanium app development with automated tests - TiConf EU 2014
PPTX
How to Get Started with Cypress
PDF
Continuous Integration: How I stopped guessing if that merge was bad
Composer at Scale, Release and Dependency Management
Midwest PHP 2017 DevOps For Small team
So You Just Inherited a $Legacy Application...
Selenium conference, 2016
Build 2017 - B8093 - Nextgen UWP app distribution: Building extensible, strea...
Speed up your Titanium app development with automated tests - TiConf EU 2014
How to Get Started with Cypress
Continuous Integration: How I stopped guessing if that merge was bad

What's hot (20)

PDF
How To Use Selenium Successfully (Java Edition)
PPTX
Advanced Appium
PDF
Mobile automation using selenium cucumber & appium
PDF
Laravel Forge: Hello World to Hello Production
PPTX
Moving From a Selenium Grid to the Cloud - A Real Life Story
PPTX
Story Testing Approach for Enterprise Applications using Selenium Framework
PDF
Tooling for the productive front end developer
PDF
Code Coverage for Total Security in Application Migrations
PPT
Selenium and Cucumber Selenium Conf 2011
PPTX
Async webdriverjs
PDF
Scaling your Automated Tests: Docker and Kubernetes
PDF
Drupal Performance
PDF
Drupalcamp Simpletest
PPTX
Cypress workshop for JSFoo 2019
PPTX
Automation Zaman Now
ODP
iOS Automation with Cucumber, Appium and Saucelabs
PPTX
Beyond the Release: CI That Transforms Organizations
PDF
Continuous delivery of your legacy application
PDF
Practical continuous quality gates for development process
KEY
Continuous Integration, the minimum viable product
How To Use Selenium Successfully (Java Edition)
Advanced Appium
Mobile automation using selenium cucumber & appium
Laravel Forge: Hello World to Hello Production
Moving From a Selenium Grid to the Cloud - A Real Life Story
Story Testing Approach for Enterprise Applications using Selenium Framework
Tooling for the productive front end developer
Code Coverage for Total Security in Application Migrations
Selenium and Cucumber Selenium Conf 2011
Async webdriverjs
Scaling your Automated Tests: Docker and Kubernetes
Drupal Performance
Drupalcamp Simpletest
Cypress workshop for JSFoo 2019
Automation Zaman Now
iOS Automation with Cucumber, Appium and Saucelabs
Beyond the Release: CI That Transforms Organizations
Continuous delivery of your legacy application
Practical continuous quality gates for development process
Continuous Integration, the minimum viable product
Ad

Similar to Put an end to regression with codeception testing (20)

PDF
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
PDF
Acceptance & Functional Testing with Codeception - Devspace 2015
PDF
Codeception: introduction to php testing
PDF
Codeception: introduction to php testing (v2 - Aberdeen php)
PDF
Acceptance testing in php with Codeception - Techmeetup Edinburgh
PDF
Mykhailo Bodnarchuk "The history of the Codeception project"
PDF
Testing with Codeception
PDF
Your code are my tests
PPTX
Test in action – week 1
PPT
Unit testing
PDF
PHPunit and you
PDF
Leveling Up With Unit Testing - LonghornPHP 2022
PPTX
Test in action week 2
PDF
Testing in Craft CMS
PPTX
Codeception
KEY
Developer testing 201: When to Mock and When to Integrate
PDF
Codeception
PDF
Testing mit Codeception: Full-stack testing PHP framework
PDF
Testing untestable code - IPC12
KEY
Developer testing 101: Become a Testing Fanatic
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Acceptance & Functional Testing with Codeception - Devspace 2015
Codeception: introduction to php testing
Codeception: introduction to php testing (v2 - Aberdeen php)
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Mykhailo Bodnarchuk "The history of the Codeception project"
Testing with Codeception
Your code are my tests
Test in action – week 1
Unit testing
PHPunit and you
Leveling Up With Unit Testing - LonghornPHP 2022
Test in action week 2
Testing in Craft CMS
Codeception
Developer testing 201: When to Mock and When to Integrate
Codeception
Testing mit Codeception: Full-stack testing PHP framework
Testing untestable code - IPC12
Developer testing 101: Become a Testing Fanatic
Ad

More from Joe Ferguson (20)

PDF
Modern infrastructure as code with ansible cake fest 2021
PDF
Modern infrastructure as code with ansible PyTN
PDF
Slim PHP when you don't need the kitchen sink
PDF
Throwing Laravel into your Legacy App™
PDF
DevSpace Conf 2017 - Making sense of the provisioning circus
PDF
Release and-dependency-management memphis python
PDF
All the Laravel Things – Up & Running to Making $$
PDF
Console Apps: php artisan forthe:win
PDF
Console Apps: php artisan forthe:win
PDF
All the Laravel things: up and running to making $$
PDF
So You Just Inherited a $Legacy Application… NomadPHP July 2016
PDF
MidwestPHP 2016 - Adventures in Laravel 5
PDF
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
PDF
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
PDF
php[world] 2015 Training - Laravel from the Ground Up
PDF
Madison PHP 2015 - DevOps For Small Teams
PDF
ZendCon 2015 - DevOps for Small Teams
PDF
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
PDF
Secure Form Processing and Protection - Devspace 2015
PDF
Laravel 5 New Features
Modern infrastructure as code with ansible cake fest 2021
Modern infrastructure as code with ansible PyTN
Slim PHP when you don't need the kitchen sink
Throwing Laravel into your Legacy App™
DevSpace Conf 2017 - Making sense of the provisioning circus
Release and-dependency-management memphis python
All the Laravel Things – Up & Running to Making $$
Console Apps: php artisan forthe:win
Console Apps: php artisan forthe:win
All the Laravel things: up and running to making $$
So You Just Inherited a $Legacy Application… NomadPHP July 2016
MidwestPHP 2016 - Adventures in Laravel 5
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
php[world] 2015 Training - Laravel from the Ground Up
Madison PHP 2015 - DevOps For Small Teams
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
Secure Form Processing and Protection - Devspace 2015
Laravel 5 New Features

Recently uploaded (20)

PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
PPT on Performance Review to get promotions
PPT
Project quality management in manufacturing
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Sustainable Sites - Green Building Construction
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Welding lecture in detail for understanding
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Construction Project Organization Group 2.pptx
PDF
composite construction of structures.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT on Performance Review to get promotions
Project quality management in manufacturing
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Sustainable Sites - Green Building Construction
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Welding lecture in detail for understanding
Automation-in-Manufacturing-Chapter-Introduction.pdf
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
CH1 Production IntroductoryConcepts.pptx
Mechanical Engineering MATERIALS Selection
Operating System & Kernel Study Guide-1 - converted.pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Lecture Notes Electrical Wiring System Components
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Construction Project Organization Group 2.pptx
composite construction of structures.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...

Put an end to regression with codeception testing