SlideShare a Scribd company logo
Codeception 
Introduction to PHP testing 
Thomas Dutrion / @tdutrion - September 2014
About me 
● Founder and developer/architect at Engineor 
● Working with PHP since 2003 
● Trying to work properly... 
@tdutrion / @engineor / thomas@engineor.com
PHP3: simple web pages 
PHP4: object? are you kidding? 
PHP5: mature language, with namespaces, real objects and so on… 
What is missing to compete with other languages? 
TESTABILITY 
Codeception 
PHP best practice: industrialisation
● Unit testing 
● Integration testing 
● Functional testing 
● Acceptance testing 
● Mutation testing 
● Monkey testing 
● ... 
Codeception 
What can we test? 
And you, how are you testing?
● Small unit of code 
● SOLID principle (single Responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) 
● Requires complete isolation 
● Long to write, requires continuous updates, expensive 
=> very good for critical parts of the application! 
Codeception 
Unit testing
● Test modules as groups 
● Simulate input 
● Less work than Unit testing (smaller number of tests) 
Codeception 
Integration testing
● Test final application appearance 
● Reproduce complete application execution 
● Client point of view 
● Less code, final result only, help on legacy projects 
=> Can be used to prove the completion of the project 
Codeception 
Acceptance testing
Codeception 
One tool: Codeception
General introduction 
Codeception 
History: 
● Started in 2011 
● Stable release in January 2012 
● Version 2.0.5 in August 2014! 
● Currently 2725 commits 
● 175 contributors... 
Problem solved: 
● Bridge between all testing types 
● No other languages required 
● Extensible 
● Covers major frameworks
PHP 5.4 minimum!!!! (you can do that, right!) 
Codeception
You already know it! 
Based on recommended and proven tools 
● PHPUnit 
● Symfony browserkit 
● Selenium / PhantomJS (optional) 
● … 
Test suite written in PHP => no need to learn another language. 
Codeception
Follow the quickstart! 
1. Install codeception (prefer using composer, globally or in dev only) 
2. Bootstrap (directories and files structure, basic configuration) 
3. Generate acceptance testing 
4. Write tests 
5. And run! 
Codeception 
Acceptance testing 101
$ php vendor/bin/codecept run 
Codeception PHP Testing Framework v2.0.5 
Powered by PHPUnit 4.2.5 by Sebastian Bergmann. 
Acceptance Tests (1) ------------------------------------------------------------------------------------------------------------ 
Trying to ensure that frontpage works (WelcomeCept) Ok 
--------------------------------------------------------------------------------------------------------------------------------- 
Functional Tests (0) --------------------------------------------------------------------- 
Unit Tests (0) --------------------------------------------------------------------------- 
Time: 382 ms, Memory: 8.50Mb 
OK (1 test, 1 assertion) 
Codeception 
Basic example results (pass)
Acceptance Tests (1) ------------------------------------------------------------------------------------------------------------ 
Trying to ensure that frontpage works (WelcomeCept) Fail 
There was 1 failure: 
1) Failed to ensure that frontpage works in WelcomeCept (/Users/thomas/NetBeansProjects/Codeception01/tests/acceptance/WelcomeCept. 
php) 
Couldn't see "Not ok": 
Failed asserting that / 
→ Your HTML code here 
[Content too long to display. See complete response in '_output' directory] 
--> contains "not ok". 
Scenario Steps: 
2. I see "Not ok" 
1. I am on page "/" 
FAILURES! 
Tests: 1, Assertions: 1, Failures: 1. 
Codeception 
Basic example results (fail)
● Since 2005, AJAX is everywhere (XmlHttpRequest) 
● New architecture: MVVM javascript in front, PHP/node… in back 
Testing problem: PHPBrowser / Curl can not read javascript modifications. 
=> Codeception can work with Selenium! 
Codeception 
What about sexy frontends?
Demonstration: Firefox run
● No Firefox and or java on your servers => no Selenium on CI 
● CI usually run only simple bash scripts 
● Need to run the test in command line, emulating an headless browser 
=> Codeception PhantomJS driver 
Codeception 
Headless testing for Continuous Integration
Codeception 
Demonstration: headless run
Workflow improvement 
● Use Docker containers or Vagrant virtual boxes to add development, testing 
Codeception 
and production servers configuration to your VCS repository 
● Add CI server triggered on commits, with email results
Questions? 
Special thanks to / reading recommendation: 
● Jeremy Coates (@phpcodemonkey) for Testing with codeception 
● PHPNW (@phpnw), great PHP group that made me discover Codeception 
● All of you for your patience and supporting my French accent! 
● Glasgow PHP (@glasgowphp) to let me talk here 
Please rate and comment this talk on SlideShare: http://goo.gl/uJIh7G 
Codeception: introduction to PHP testing, by Thomas Dutrion from Engineor for Glasgow PHP, September 2014
Ad

Recommended

Codeception introduction and use in Yii
Codeception introduction and use in Yii
IlPeach
 
Codeception
Codeception
Jonathan Lau
 
Testing with Codeception
Testing with Codeception
Jeremy Coates
 
Test automation with php codeception
Test automation with php codeception
buddhieash
 
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Joe Ferguson
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
Joe Ferguson
 
Codeception presentation
Codeception presentation
Andrei Burian
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Cogapp
 
Codeception
Codeception
少東 張
 
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Engineor
 
PHP Unit Testing in Yii
PHP Unit Testing in Yii
IlPeach
 
CI / CD w/ Codeception
CI / CD w/ Codeception
Tudor Barbu
 
Testing PHP with Codeception
Testing PHP with Codeception
John Paul Ada
 
From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.
David Aguilera
 
Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)
Adam Štipák
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)
Engineor
 
Automation using Javascript
Automation using Javascript
khanhdang1214
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
Mehdi Khalili
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
vodQA
 
Front-End Testing: Demystified
Front-End Testing: Demystified
Seth McLaughlin
 
Selenium Basics Tutorial
Selenium Basics Tutorial
Clever Moe
 
Testing Web Applications
Testing Web Applications
Seth McLaughlin
 
Testing with laravel
Testing with laravel
Derek Binkley
 
Integration Testing in Python
Integration Testing in Python
Panoptic Development, Inc.
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Top trending selenium interview questions
Top trending selenium interview questions
Rock Interview
 
Selenium - Introduction
Selenium - Introduction
Amr E. Mohamed
 
Unit testing - A&BP CC
Unit testing - A&BP CC
JWORKS powered by Ordina
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
Shyam Sunder Verma
 
Continuous Integration In Php
Continuous Integration In Php
Wilco Jansen
 

More Related Content

What's hot (20)

Codeception
Codeception
少東 張
 
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Engineor
 
PHP Unit Testing in Yii
PHP Unit Testing in Yii
IlPeach
 
CI / CD w/ Codeception
CI / CD w/ Codeception
Tudor Barbu
 
Testing PHP with Codeception
Testing PHP with Codeception
John Paul Ada
 
From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.
David Aguilera
 
Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)
Adam Štipák
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)
Engineor
 
Automation using Javascript
Automation using Javascript
khanhdang1214
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
Mehdi Khalili
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
vodQA
 
Front-End Testing: Demystified
Front-End Testing: Demystified
Seth McLaughlin
 
Selenium Basics Tutorial
Selenium Basics Tutorial
Clever Moe
 
Testing Web Applications
Testing Web Applications
Seth McLaughlin
 
Testing with laravel
Testing with laravel
Derek Binkley
 
Integration Testing in Python
Integration Testing in Python
Panoptic Development, Inc.
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Top trending selenium interview questions
Top trending selenium interview questions
Rock Interview
 
Selenium - Introduction
Selenium - Introduction
Amr E. Mohamed
 
Unit testing - A&BP CC
Unit testing - A&BP CC
JWORKS powered by Ordina
 
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Engineor
 
PHP Unit Testing in Yii
PHP Unit Testing in Yii
IlPeach
 
CI / CD w/ Codeception
CI / CD w/ Codeception
Tudor Barbu
 
Testing PHP with Codeception
Testing PHP with Codeception
John Paul Ada
 
From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.
David Aguilera
 
Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)
Adam Štipák
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)
Engineor
 
Automation using Javascript
Automation using Javascript
khanhdang1214
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
Mehdi Khalili
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
vodQA
 
Front-End Testing: Demystified
Front-End Testing: Demystified
Seth McLaughlin
 
Selenium Basics Tutorial
Selenium Basics Tutorial
Clever Moe
 
Testing Web Applications
Testing Web Applications
Seth McLaughlin
 
Testing with laravel
Testing with laravel
Derek Binkley
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Top trending selenium interview questions
Top trending selenium interview questions
Rock Interview
 
Selenium - Introduction
Selenium - Introduction
Amr E. Mohamed
 

Similar to Codeception: introduction to php testing (20)

Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
Shyam Sunder Verma
 
Continuous Integration In Php
Continuous Integration In Php
Wilco Jansen
 
Codeception @ New Business Dept Adira Finance
Codeception @ New Business Dept Adira Finance
Fachrul Choliluddin
 
[ENGLISH] TDC 2015 - PHP Trail - Tests and PHP Continuous Integration Enviro...
[ENGLISH] TDC 2015 - PHP Trail - Tests and PHP Continuous Integration Enviro...
Bruno Tanoue
 
UPC Plone Testing Talk
UPC Plone Testing Talk
Timo Stollenwerk
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
Sam Becker
 
Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)
Peter Kofler
 
Behaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’s
Andrew Kirkpatrick
 
Behaviour Testing and Continuous Integration with Drupal
Behaviour Testing and Continuous Integration with Drupal
smithmilner
 
Continuous Integration at Mollie
Continuous Integration at Mollie
willemstuursma
 
TDD for joomla extensions
TDD for joomla extensions
Roberto Segura
 
PHP - Programming language war, does it matter
PHP - Programming language war, does it matter
Mizno Kruge
 
Automated Web Testing With Selenium
Automated Web Testing With Selenium
Jodie Miners
 
Selenium web driver_2.0_presentation
Selenium web driver_2.0_presentation
sayhi2sudarshan
 
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Andrew Yatsenko
 
Framework
Framework
Seungjoon Lee
 
Lighning Talk: PHP build process
Lighning Talk: PHP build process
Bryan Agee
 
Test driven development - Zombie proof your code
Test driven development - Zombie proof your code
Pascal Larocque
 
Test Driven Development with PHP
Test Driven Development with PHP
Rogério Vicente
 
Test Driven Development (TDD) with Windows PowerShell
Test Driven Development (TDD) with Windows PowerShell
Hemmerling
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
Shyam Sunder Verma
 
Continuous Integration In Php
Continuous Integration In Php
Wilco Jansen
 
Codeception @ New Business Dept Adira Finance
Codeception @ New Business Dept Adira Finance
Fachrul Choliluddin
 
[ENGLISH] TDC 2015 - PHP Trail - Tests and PHP Continuous Integration Enviro...
[ENGLISH] TDC 2015 - PHP Trail - Tests and PHP Continuous Integration Enviro...
Bruno Tanoue
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
Sam Becker
 
Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)
Peter Kofler
 
Behaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’s
Andrew Kirkpatrick
 
Behaviour Testing and Continuous Integration with Drupal
Behaviour Testing and Continuous Integration with Drupal
smithmilner
 
Continuous Integration at Mollie
Continuous Integration at Mollie
willemstuursma
 
TDD for joomla extensions
TDD for joomla extensions
Roberto Segura
 
PHP - Programming language war, does it matter
PHP - Programming language war, does it matter
Mizno Kruge
 
Automated Web Testing With Selenium
Automated Web Testing With Selenium
Jodie Miners
 
Selenium web driver_2.0_presentation
Selenium web driver_2.0_presentation
sayhi2sudarshan
 
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Andrew Yatsenko
 
Lighning Talk: PHP build process
Lighning Talk: PHP build process
Bryan Agee
 
Test driven development - Zombie proof your code
Test driven development - Zombie proof your code
Pascal Larocque
 
Test Driven Development with PHP
Test Driven Development with PHP
Rogério Vicente
 
Test Driven Development (TDD) with Windows PowerShell
Test Driven Development (TDD) with Windows PowerShell
Hemmerling
 
Ad

Recently uploaded (20)

Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
Ad

Codeception: introduction to php testing

  • 1. Codeception Introduction to PHP testing Thomas Dutrion / @tdutrion - September 2014
  • 2. About me ● Founder and developer/architect at Engineor ● Working with PHP since 2003 ● Trying to work properly... @tdutrion / @engineor / [email protected]
  • 3. PHP3: simple web pages PHP4: object? are you kidding? PHP5: mature language, with namespaces, real objects and so on… What is missing to compete with other languages? TESTABILITY Codeception PHP best practice: industrialisation
  • 4. ● Unit testing ● Integration testing ● Functional testing ● Acceptance testing ● Mutation testing ● Monkey testing ● ... Codeception What can we test? And you, how are you testing?
  • 5. ● Small unit of code ● SOLID principle (single Responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) ● Requires complete isolation ● Long to write, requires continuous updates, expensive => very good for critical parts of the application! Codeception Unit testing
  • 6. ● Test modules as groups ● Simulate input ● Less work than Unit testing (smaller number of tests) Codeception Integration testing
  • 7. ● Test final application appearance ● Reproduce complete application execution ● Client point of view ● Less code, final result only, help on legacy projects => Can be used to prove the completion of the project Codeception Acceptance testing
  • 8. Codeception One tool: Codeception
  • 9. General introduction Codeception History: ● Started in 2011 ● Stable release in January 2012 ● Version 2.0.5 in August 2014! ● Currently 2725 commits ● 175 contributors... Problem solved: ● Bridge between all testing types ● No other languages required ● Extensible ● Covers major frameworks
  • 10. PHP 5.4 minimum!!!! (you can do that, right!) Codeception
  • 11. You already know it! Based on recommended and proven tools ● PHPUnit ● Symfony browserkit ● Selenium / PhantomJS (optional) ● … Test suite written in PHP => no need to learn another language. Codeception
  • 12. Follow the quickstart! 1. Install codeception (prefer using composer, globally or in dev only) 2. Bootstrap (directories and files structure, basic configuration) 3. Generate acceptance testing 4. Write tests 5. And run! Codeception Acceptance testing 101
  • 13. $ php vendor/bin/codecept run Codeception PHP Testing Framework v2.0.5 Powered by PHPUnit 4.2.5 by Sebastian Bergmann. Acceptance Tests (1) ------------------------------------------------------------------------------------------------------------ Trying to ensure that frontpage works (WelcomeCept) Ok --------------------------------------------------------------------------------------------------------------------------------- Functional Tests (0) --------------------------------------------------------------------- Unit Tests (0) --------------------------------------------------------------------------- Time: 382 ms, Memory: 8.50Mb OK (1 test, 1 assertion) Codeception Basic example results (pass)
  • 14. Acceptance Tests (1) ------------------------------------------------------------------------------------------------------------ Trying to ensure that frontpage works (WelcomeCept) Fail There was 1 failure: 1) Failed to ensure that frontpage works in WelcomeCept (/Users/thomas/NetBeansProjects/Codeception01/tests/acceptance/WelcomeCept. php) Couldn't see "Not ok": Failed asserting that / → Your HTML code here [Content too long to display. See complete response in '_output' directory] --> contains "not ok". Scenario Steps: 2. I see "Not ok" 1. I am on page "/" FAILURES! Tests: 1, Assertions: 1, Failures: 1. Codeception Basic example results (fail)
  • 15. ● Since 2005, AJAX is everywhere (XmlHttpRequest) ● New architecture: MVVM javascript in front, PHP/node… in back Testing problem: PHPBrowser / Curl can not read javascript modifications. => Codeception can work with Selenium! Codeception What about sexy frontends?
  • 17. ● No Firefox and or java on your servers => no Selenium on CI ● CI usually run only simple bash scripts ● Need to run the test in command line, emulating an headless browser => Codeception PhantomJS driver Codeception Headless testing for Continuous Integration
  • 19. Workflow improvement ● Use Docker containers or Vagrant virtual boxes to add development, testing Codeception and production servers configuration to your VCS repository ● Add CI server triggered on commits, with email results
  • 20. Questions? Special thanks to / reading recommendation: ● Jeremy Coates (@phpcodemonkey) for Testing with codeception ● PHPNW (@phpnw), great PHP group that made me discover Codeception ● All of you for your patience and supporting my French accent! ● Glasgow PHP (@glasgowphp) to let me talk here Please rate and comment this talk on SlideShare: http://goo.gl/uJIh7G Codeception: introduction to PHP testing, by Thomas Dutrion from Engineor for Glasgow PHP, September 2014