SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
Text
Introducing Codeception
(TDD)—>Test Driven Development
Agenda
Presentation of Speaker/ Company
Presentation of Codeception
Presentation of Tests Types
Demonstration & Hands-on
Best Practices
References
Q & A
@phpcon_kansai
Who the hell am I ?
Batard Florent (28 years old)(Shenril)
Twitter: @shenril
Facebook: Florent Btd
Security Engineer (Ethical Hacker)
French Globe Trotter
Lived in France,UK,Switzerland,U.S,Japan
Fan of Japan and especially Kansai area and people
Style learning Japanese….
Who the hell am I ?
Batard Florent (28 years old)(Shenril)
Twitter: @shenril
Facebook: Florent Btd
Security Engineer (Ethical Hacker)
French Globe Trotter
Lived in France,UK,Switzerland,U.S,Japan
Fan of Japan and especially Kansai area and people
Style learning Japanese….
Who the hell am I ?
Batard Florent (28 years old)(Shenril)
Twitter: @shenril
Facebook: Florent Btd
Security Engineer (Ethical Hacker)
French Globe Trotter
Lived in France,UK,Switzerland,U.S,Japan
Fan of Japan and especially Kansai area and people
Style learning Japanese….
Who the hell am I ?
Batard Florent (28 years old)(Shenril)
Twitter: @shenril
Facebook: Florent Btd
Security Engineer (Ethical Hacker)
French Globe Trotter
Lived in France,UK,Switzerland,U.S,Japan
Fan of Japan and especially Kansai area and people
Style learning Japanese….
Who the hell am I ?
Batard Florent (28 years old)(Shenril)
Twitter: @shenril
Facebook: Florent Btd
Security Engineer (Ethical Hacker)
French Globe Trotter
Lived in France,UK,Switzerland,U.S,Japan
Fan of Japan and especially Kansai area and people
Style learning Japanese….
Who the hell am I ?
Batard Florent (28 years old)(Shenril)
Twitter: @shenril
Facebook: Florent Btd
Security Engineer (Ethical Hacker)
French Globe Trotter
Lived in France,UK,Switzerland,U.S,Japan
Fan of Japan and especially Kansai area and people
Style learning Japanese….
Who the hell am I ?
Batard Florent (28 years old)(Shenril)
Twitter: @shenril
Facebook: Florent Btd
Security Engineer (Ethical Hacker)
French Globe Trotter
Lived in France,UK,Switzerland,U.S,Japan
Fan of Japan and especially Kansai area and people
Style learning Japanese….
Why do i speak here?
Worked for:
W3C in Sophia Antipolis
U.N (Security Consultant)
Private Banking
Television
Did conferences in Europe
Mainly Security (Youtube) (sorry french and english only)
Active Member of OWASP (Web Security Project)
Web Developer for the past 10 years
Interested in DevOps ,Servers, Infrastructure, Artificial Intelligence
Learning Animal
Why do i speak here?
Worked for:
W3C in Sophia Antipolis
U.N (Security Consultant)
Private Banking
Television
Did conferences in Europe
Mainly Security (Youtube) (sorry french and english only)
Active Member of OWASP (Web Security Project)
Web Developer for the past 10 years
Interested in DevOps ,Servers, Infrastructure, Artificial Intelligence
Learning Animal
Why do i speak here?
Worked for:
W3C in Sophia Antipolis
U.N (Security Consultant)
Private Banking
Television
Did conferences in Europe
Mainly Security (Youtube) (sorry french and english only)
Active Member of OWASP (Web Security Project)
Web Developer for the past 10 years
Interested in DevOps ,Servers, Infrastructure, Artificial Intelligence
Learning Animal
Why do i speak here?
Worked for:
W3C in Sophia Antipolis
U.N (Security Consultant)
Private Banking
Television
Did conferences in Europe
Mainly Security (Youtube) (sorry french and english only)
Active Member of OWASP (Web Security Project)
Web Developer for the past 10 years
Interested in DevOps ,Servers, Infrastructure, Artificial Intelligence
Learning Animal
Who do I work for?
Cook+biz
Awesome Team
Awesome Challenges
Who do I work for?
Cook+biz
Awesome Team
Awesome Challenges
Who do I work for?
Cook+biz
Awesome Team
Awesome Challenges
Why Testing?
Why should I test my code ?
Reduce False assumptions -> If you rely on assumptions it will surely fail…
Validate that there is no regression
Make sure the code runs as expected
Test limit values (security,big data)
Automate repetitive tasks -> Good developers are lazy developers!!!
It makes debugging/correction so much easier
But…
Often developers finds it hard to write
Too long too run
Doesn’t correspond to business logic/behaviour/user scenario
CodeCeption(1)
http://codeception.com/ (English)
Test Framework
Acceptance Tests
Functional Tests
Unit Tests
Easy
To read
To write
To debug
Natively handles PHPUnit -> standard
CodeCeption(2)
BDD-style scenario-driver tests
WebServices tests (SOAP/REST/XML-RPC)
Generates reports(HTML/XML/JSON)
Laravel/Zend/Phalcon/Yii2/Symfony/Composer modules -
> No excuse!
Integration with continuous deployment (Jenkins/Bamboo)
Can be used along with Selenium2 and PhantomJS for
advanced tests
What does it look like?
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('create wiki page');
$I->amOnPage('/');
$I->click('Pages');
$I->click('New');
$I->see('New Page');
$I->fillField('title', 'Hobbit');
$I->fillField('body', 'By Peter Jackson');
$I->click('Save');
$I->see('page created'); // notice generated
$I->see('Hobbit','h1'); // head of page of is our title
$I->seeInCurrentUrl('pages/hobbit');
$I->seeInDatabase('pages', array('title' => ‘Hobbit'));
?>
Different tests types
Acceptance
Tests
Functional
Tests
Unit Tests
Yii2 BackendFrontend
Browser
Selenium
PhantomJS
HTML
HTML
$_GET,$_POST,
$_REQUEST
Yii2 Module Backend
Different tests types
Acceptance
Tests
Functional
Tests
Unit Tests
Yii2 BackendFrontend
Browser
Selenium
PhantomJS
HTML
HTML
$_GET,$_POST,
$_REQUEST
Yii2 Module Backend
Different tests types
Acceptance
Tests
Functional
Tests
Unit Tests
Yii2 BackendFrontend
Browser
Selenium
PhantomJS
HTML
HTML
$_GET,$_POST,
$_REQUEST
Yii2 Module Backend
User Scenario
Different tests types
Acceptance
Tests
Functional
Tests
Unit Tests
Yii2 BackendFrontend
Browser
Selenium
PhantomJS
HTML
HTML
$_GET,$_POST,
$_REQUEST
Yii2 Module Backend
User Scenario
Different tests types
Acceptance
Tests
Functional
Tests
Unit Tests
Yii2 BackendFrontend
Browser
Selenium
PhantomJS
HTML
HTML
$_GET,$_POST,
$_REQUEST
Yii2 Module Backend
User Scenario
Developer Scenario
Different tests types
Acceptance
Tests
Functional
Tests
Unit Tests
Yii2 BackendFrontend
Browser
Selenium
PhantomJS
HTML
HTML
$_GET,$_POST,
$_REQUEST
Yii2 Module Backend
User Scenario
Developer Scenario
Different tests types
Acceptance
Tests
Functional
Tests
Unit Tests
Yii2 BackendFrontend
Browser
Selenium
PhantomJS
HTML
HTML
$_GET,$_POST,
$_REQUEST
Yii2 Module Backend
User Scenario
Developer Scenario
Function Testing
Acceptance Tests
Enable to do request and interact with the DOM
Use a fake browser to perform the queries
Can click and fill forms
Can be plugged with Selenium/PhantomJS to interact
with JavaScript and screenshots
Slowest tests to run
Functional Tests
Same as Acceptance test but does not use a browser
engine
Can be plugged with the framework to access internal
functions and properties (Models, validation)
Use $_REQUEST, $_POST and $_GET
Faster
No DOM interaction (JS/Ajax/Events)
Unit Tests
Used to test functions
Can be plugged with the framework to access internal functions and properties (Models, Validation)
Fastest
Difficult to use in MVC
Not readable by Humans
public function testValidation()
{
$user = User::create();
$user->username = null;
$this->assertFalse($user->validate(['username']));
$user->username = 'toolooooongnaaaaaaameeee';
$this->assertFalse($user->validate(['username']));
$user->username = 'davert';
$this->assertTrue($user->validate(['username']));
}
Install on all platforms
Mac OSX:
brew update && brew install homebrew/php/codeception
Linux:
wget http://codeception.com/codecept.phar .
php codecept.phar bootstrap
Windows:
php composer.phar global require “codeception/codeception:*”
Composer/ PhpStorm:
php composer.phar require “codeception/codeception:*”
Getting ready
BootStrap
>codecept bootstrap
>codecept generate:cept acceptance Validation
Edit the configuration file : tests/acceptance.suite.yml
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser
- AcceptanceHelper
config:
PhpBrowser:
url: ‘http://conference.kphpug.jp/2015/’
Let’s get the party started
>codecept run
>codecept run —debug
Bonus
>codecept generate:scenarios acceptance //English version
>codecept console acceptance //Interactive console
>codecept run —debug —env test
Demo Time !!!!!
> Let’s test PHP conference Kansai website !
Best practices
1. Run tests on your vagrant -> GIT push ONLY when tests pass
2. Deploy on test server -> Validate tests on test server
3. Deploy on production ONLY if tests pass on test server
4. NEVER run on production ! NEVER!!!
1. It creates new entries and change Database
2. Add load on the production server
3. Need new set of tests/monitoring on production
References
Installation : http://codeception.com/install
Acceptance Tests : http://codeception.com/docs/04-AcceptanceTests
Yii2 module : http://codeception.com/docs/modules/Yii2
WebDriver : http://codeception.com/docs/modules/WebDriver
Yii2 Database Faker : http://qiita.com/tanakahisateru/items/
c4d39cc77a71067ed658
Other tools
PHPUnit Framework(Difficult)
phpspec (Specification & Unit Testing)
Pure Selenium/PhantomJS (Harder integration)
Mink (Browser Controlling, slow,harder integration)
Questions & Answers
Do you have any questions?

Contenu connexe

Tendances

Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Babul Mirdha
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)David Ehringer
 
Dependency Injection in iOS
Dependency Injection in iOSDependency Injection in iOS
Dependency Injection in iOSPablo Villar
 
Test driven development
Test driven developmentTest driven development
Test driven developmentNascenia IT
 
When develpment met test(shift left testing)
When develpment met test(shift left testing)When develpment met test(shift left testing)
When develpment met test(shift left testing)SangIn Choung
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven TestingMaveryx
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowRachid Kherrazi
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)Brian Rasmussen
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven DevelopmentJohn Blum
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentMireia Sangalo
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010guest5639fa9
 
Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief exampleJeremy Kendall
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) CodeOps Technologies LLP
 

Tendances (20)

Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
 
PHPUnit - Unit testing
PHPUnit - Unit testingPHPUnit - Unit testing
PHPUnit - Unit testing
 
Codeception
CodeceptionCodeception
Codeception
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)
 
Dependency Injection in iOS
Dependency Injection in iOSDependency Injection in iOS
Dependency Injection in iOS
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
When develpment met test(shift left testing)
When develpment met test(shift left testing)When develpment met test(shift left testing)
When develpment met test(shift left testing)
 
Automation and Technical Debt
Automation and Technical DebtAutomation and Technical Debt
Automation and Technical Debt
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testing
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlow
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
TDD and BDD and ATDD
TDD and BDD and ATDDTDD and BDD and ATDD
TDD and BDD and ATDD
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD)
 

En vedette

A Doctor’s Perspective on the Future Role of Pharmaceutical-Doctor Relationsh...
A Doctor’s Perspective on the Future Role of Pharmaceutical-Doctor Relationsh...A Doctor’s Perspective on the Future Role of Pharmaceutical-Doctor Relationsh...
A Doctor’s Perspective on the Future Role of Pharmaceutical-Doctor Relationsh...Marketing Network marcus evans
 
Microsoft H1B Violations
Microsoft H1B ViolationsMicrosoft H1B Violations
Microsoft H1B ViolationsH1B
 
Evolution of Software Engineering in NCTR Projects
Evolution of Software Engineering in NCTR  Projects   Evolution of Software Engineering in NCTR  Projects
Evolution of Software Engineering in NCTR Projects Mohammed Abbas
 
33 Essential Social Recruiting Stats - 2011
33 Essential Social Recruiting Stats - 201133 Essential Social Recruiting Stats - 2011
33 Essential Social Recruiting Stats - 2011Steven Duque
 
Patient matching in FHIR
Patient matching in FHIRPatient matching in FHIR
Patient matching in FHIRGrahame Grieve
 
Canadian Healthcare Codes and Terminology Standards
Canadian Healthcare Codes and Terminology StandardsCanadian Healthcare Codes and Terminology Standards
Canadian Healthcare Codes and Terminology Standards Intelliware Development Inc.
 
Power Pointless How To Make An Amazing Presentation
Power Pointless How To Make An Amazing PresentationPower Pointless How To Make An Amazing Presentation
Power Pointless How To Make An Amazing PresentationJoan Shi
 
I2 Argentina Unitech
I2 Argentina UnitechI2 Argentina Unitech
I2 Argentina UnitechUNITECH S.A.
 
Environmental Law for Road Builders
Environmental Law for Road Builders Environmental Law for Road Builders
Environmental Law for Road Builders DSaxe
 
Quelle gouvernance pour le numérique?
Quelle gouvernance pour le numérique?Quelle gouvernance pour le numérique?
Quelle gouvernance pour le numérique?Antoine Vigneron
 
Clinical development, contract & outsourcing in mena & asia pac webinar-l aju...
Clinical development, contract & outsourcing in mena & asia pac webinar-l aju...Clinical development, contract & outsourcing in mena & asia pac webinar-l aju...
Clinical development, contract & outsourcing in mena & asia pac webinar-l aju...Larry Ajuwon
 
Enterprise Wearables: Wearing Our Parts On Our Sleeves - How Wearable Technol...
Enterprise Wearables: Wearing Our Parts On Our Sleeves - How Wearable Technol...Enterprise Wearables: Wearing Our Parts On Our Sleeves - How Wearable Technol...
Enterprise Wearables: Wearing Our Parts On Our Sleeves - How Wearable Technol...Intelliware Development Inc.
 

En vedette (20)

A Doctor’s Perspective on the Future Role of Pharmaceutical-Doctor Relationsh...
A Doctor’s Perspective on the Future Role of Pharmaceutical-Doctor Relationsh...A Doctor’s Perspective on the Future Role of Pharmaceutical-Doctor Relationsh...
A Doctor’s Perspective on the Future Role of Pharmaceutical-Doctor Relationsh...
 
Rocks on Rocks
Rocks on RocksRocks on Rocks
Rocks on Rocks
 
Microsoft H1B Violations
Microsoft H1B ViolationsMicrosoft H1B Violations
Microsoft H1B Violations
 
Evolution of Software Engineering in NCTR Projects
Evolution of Software Engineering in NCTR  Projects   Evolution of Software Engineering in NCTR  Projects
Evolution of Software Engineering in NCTR Projects
 
Afrika Tikkun Annual Review
Afrika Tikkun Annual ReviewAfrika Tikkun Annual Review
Afrika Tikkun Annual Review
 
33 Essential Social Recruiting Stats - 2011
33 Essential Social Recruiting Stats - 201133 Essential Social Recruiting Stats - 2011
33 Essential Social Recruiting Stats - 2011
 
Patient matching in FHIR
Patient matching in FHIRPatient matching in FHIR
Patient matching in FHIR
 
Assignment brief
Assignment brief Assignment brief
Assignment brief
 
Canadian Healthcare Codes and Terminology Standards
Canadian Healthcare Codes and Terminology StandardsCanadian Healthcare Codes and Terminology Standards
Canadian Healthcare Codes and Terminology Standards
 
Power Pointless How To Make An Amazing Presentation
Power Pointless How To Make An Amazing PresentationPower Pointless How To Make An Amazing Presentation
Power Pointless How To Make An Amazing Presentation
 
Hong kong
Hong kongHong kong
Hong kong
 
City of deception
City of deceptionCity of deception
City of deception
 
I2 Argentina Unitech
I2 Argentina UnitechI2 Argentina Unitech
I2 Argentina Unitech
 
Why Nortel Went Bankrupt
Why Nortel Went BankruptWhy Nortel Went Bankrupt
Why Nortel Went Bankrupt
 
Agile Testing
Agile Testing  Agile Testing
Agile Testing
 
Environmental Law for Road Builders
Environmental Law for Road Builders Environmental Law for Road Builders
Environmental Law for Road Builders
 
Quelle gouvernance pour le numérique?
Quelle gouvernance pour le numérique?Quelle gouvernance pour le numérique?
Quelle gouvernance pour le numérique?
 
Master of deception (mod)
Master of deception (mod)Master of deception (mod)
Master of deception (mod)
 
Clinical development, contract & outsourcing in mena & asia pac webinar-l aju...
Clinical development, contract & outsourcing in mena & asia pac webinar-l aju...Clinical development, contract & outsourcing in mena & asia pac webinar-l aju...
Clinical development, contract & outsourcing in mena & asia pac webinar-l aju...
 
Enterprise Wearables: Wearing Our Parts On Our Sleeves - How Wearable Technol...
Enterprise Wearables: Wearing Our Parts On Our Sleeves - How Wearable Technol...Enterprise Wearables: Wearing Our Parts On Our Sleeves - How Wearable Technol...
Enterprise Wearables: Wearing Our Parts On Our Sleeves - How Wearable Technol...
 

Similaire à Codeception Testing Framework -- English #phpkansai

Watir Presentation Sumanth Krishna. A
Watir Presentation   Sumanth Krishna. AWatir Presentation   Sumanth Krishna. A
Watir Presentation Sumanth Krishna. ASumanth krishna
 
Building Web Sites that Work Everywhere
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work EverywhereDoris Chen
 
Joomla Day Austin Part 4
Joomla Day Austin Part 4Joomla Day Austin Part 4
Joomla Day Austin Part 4Kyle Ledbetter
 
Android design patterns
Android design patternsAndroid design patterns
Android design patternsVitali Pekelis
 
Iz Pack
Iz PackIz Pack
Iz PackInria
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7Wim Godden
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Ivo Jansch
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldLorna Mitchell
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
 
Frontend testing of (legacy) websites
Frontend testing of (legacy) websitesFrontend testing of (legacy) websites
Frontend testing of (legacy) websitesMichael Kubovic
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6Wim Godden
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfonyFrancois Zaninotto
 
Development workflow
Development workflowDevelopment workflow
Development workflowSigsiu.NET
 
Modern Web Security, Lazy but Mindful Like a Fox
Modern Web Security, Lazy but Mindful Like a FoxModern Web Security, Lazy but Mindful Like a Fox
Modern Web Security, Lazy but Mindful Like a FoxC4Media
 
Ran Mizrahi - Symfony2 meets Drupal8
Ran Mizrahi - Symfony2 meets Drupal8Ran Mizrahi - Symfony2 meets Drupal8
Ran Mizrahi - Symfony2 meets Drupal8Ran Mizrahi
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitJames Fuller
 
The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4Wim Godden
 

Similaire à Codeception Testing Framework -- English #phpkansai (20)

Watir Presentation Sumanth Krishna. A
Watir Presentation   Sumanth Krishna. AWatir Presentation   Sumanth Krishna. A
Watir Presentation Sumanth Krishna. A
 
Building Web Sites that Work Everywhere
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work Everywhere
 
Joomla Day Austin Part 4
Joomla Day Austin Part 4Joomla Day Austin Part 4
Joomla Day Austin Part 4
 
Android design patterns
Android design patternsAndroid design patterns
Android design patterns
 
Iz Pack
Iz PackIz Pack
Iz Pack
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP World
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
Frontend testing of (legacy) websites
Frontend testing of (legacy) websitesFrontend testing of (legacy) websites
Frontend testing of (legacy) websites
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
Le Tour de xUnit
Le Tour de xUnitLe Tour de xUnit
Le Tour de xUnit
 
Development workflow
Development workflowDevelopment workflow
Development workflow
 
Modern Web Security, Lazy but Mindful Like a Fox
Modern Web Security, Lazy but Mindful Like a FoxModern Web Security, Lazy but Mindful Like a Fox
Modern Web Security, Lazy but Mindful Like a Fox
 
Ran Mizrahi - Symfony2 meets Drupal8
Ran Mizrahi - Symfony2 meets Drupal8Ran Mizrahi - Symfony2 meets Drupal8
Ran Mizrahi - Symfony2 meets Drupal8
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
 
Yahoo is open to developers
Yahoo is open to developersYahoo is open to developers
Yahoo is open to developers
 
The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4
 

Dernier

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Dernier (20)

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

Codeception Testing Framework -- English #phpkansai

  • 2. Agenda Presentation of Speaker/ Company Presentation of Codeception Presentation of Tests Types Demonstration & Hands-on Best Practices References Q & A @phpcon_kansai
  • 3. Who the hell am I ? Batard Florent (28 years old)(Shenril) Twitter: @shenril Facebook: Florent Btd Security Engineer (Ethical Hacker) French Globe Trotter Lived in France,UK,Switzerland,U.S,Japan Fan of Japan and especially Kansai area and people Style learning Japanese….
  • 4. Who the hell am I ? Batard Florent (28 years old)(Shenril) Twitter: @shenril Facebook: Florent Btd Security Engineer (Ethical Hacker) French Globe Trotter Lived in France,UK,Switzerland,U.S,Japan Fan of Japan and especially Kansai area and people Style learning Japanese….
  • 5. Who the hell am I ? Batard Florent (28 years old)(Shenril) Twitter: @shenril Facebook: Florent Btd Security Engineer (Ethical Hacker) French Globe Trotter Lived in France,UK,Switzerland,U.S,Japan Fan of Japan and especially Kansai area and people Style learning Japanese….
  • 6. Who the hell am I ? Batard Florent (28 years old)(Shenril) Twitter: @shenril Facebook: Florent Btd Security Engineer (Ethical Hacker) French Globe Trotter Lived in France,UK,Switzerland,U.S,Japan Fan of Japan and especially Kansai area and people Style learning Japanese….
  • 7. Who the hell am I ? Batard Florent (28 years old)(Shenril) Twitter: @shenril Facebook: Florent Btd Security Engineer (Ethical Hacker) French Globe Trotter Lived in France,UK,Switzerland,U.S,Japan Fan of Japan and especially Kansai area and people Style learning Japanese….
  • 8. Who the hell am I ? Batard Florent (28 years old)(Shenril) Twitter: @shenril Facebook: Florent Btd Security Engineer (Ethical Hacker) French Globe Trotter Lived in France,UK,Switzerland,U.S,Japan Fan of Japan and especially Kansai area and people Style learning Japanese….
  • 9. Who the hell am I ? Batard Florent (28 years old)(Shenril) Twitter: @shenril Facebook: Florent Btd Security Engineer (Ethical Hacker) French Globe Trotter Lived in France,UK,Switzerland,U.S,Japan Fan of Japan and especially Kansai area and people Style learning Japanese….
  • 10. Why do i speak here? Worked for: W3C in Sophia Antipolis U.N (Security Consultant) Private Banking Television Did conferences in Europe Mainly Security (Youtube) (sorry french and english only) Active Member of OWASP (Web Security Project) Web Developer for the past 10 years Interested in DevOps ,Servers, Infrastructure, Artificial Intelligence Learning Animal
  • 11. Why do i speak here? Worked for: W3C in Sophia Antipolis U.N (Security Consultant) Private Banking Television Did conferences in Europe Mainly Security (Youtube) (sorry french and english only) Active Member of OWASP (Web Security Project) Web Developer for the past 10 years Interested in DevOps ,Servers, Infrastructure, Artificial Intelligence Learning Animal
  • 12. Why do i speak here? Worked for: W3C in Sophia Antipolis U.N (Security Consultant) Private Banking Television Did conferences in Europe Mainly Security (Youtube) (sorry french and english only) Active Member of OWASP (Web Security Project) Web Developer for the past 10 years Interested in DevOps ,Servers, Infrastructure, Artificial Intelligence Learning Animal
  • 13. Why do i speak here? Worked for: W3C in Sophia Antipolis U.N (Security Consultant) Private Banking Television Did conferences in Europe Mainly Security (Youtube) (sorry french and english only) Active Member of OWASP (Web Security Project) Web Developer for the past 10 years Interested in DevOps ,Servers, Infrastructure, Artificial Intelligence Learning Animal
  • 14. Who do I work for? Cook+biz Awesome Team Awesome Challenges
  • 15. Who do I work for? Cook+biz Awesome Team Awesome Challenges
  • 16. Who do I work for? Cook+biz Awesome Team Awesome Challenges
  • 17. Why Testing? Why should I test my code ? Reduce False assumptions -> If you rely on assumptions it will surely fail… Validate that there is no regression Make sure the code runs as expected Test limit values (security,big data) Automate repetitive tasks -> Good developers are lazy developers!!! It makes debugging/correction so much easier But… Often developers finds it hard to write Too long too run Doesn’t correspond to business logic/behaviour/user scenario
  • 18. CodeCeption(1) http://codeception.com/ (English) Test Framework Acceptance Tests Functional Tests Unit Tests Easy To read To write To debug Natively handles PHPUnit -> standard
  • 19. CodeCeption(2) BDD-style scenario-driver tests WebServices tests (SOAP/REST/XML-RPC) Generates reports(HTML/XML/JSON) Laravel/Zend/Phalcon/Yii2/Symfony/Composer modules - > No excuse! Integration with continuous deployment (Jenkins/Bamboo) Can be used along with Selenium2 and PhantomJS for advanced tests
  • 20. What does it look like? <?php $I = new AcceptanceTester($scenario); $I->wantTo('create wiki page'); $I->amOnPage('/'); $I->click('Pages'); $I->click('New'); $I->see('New Page'); $I->fillField('title', 'Hobbit'); $I->fillField('body', 'By Peter Jackson'); $I->click('Save'); $I->see('page created'); // notice generated $I->see('Hobbit','h1'); // head of page of is our title $I->seeInCurrentUrl('pages/hobbit'); $I->seeInDatabase('pages', array('title' => ‘Hobbit')); ?>
  • 21.
  • 22. Different tests types Acceptance Tests Functional Tests Unit Tests Yii2 BackendFrontend Browser Selenium PhantomJS HTML HTML $_GET,$_POST, $_REQUEST Yii2 Module Backend
  • 23. Different tests types Acceptance Tests Functional Tests Unit Tests Yii2 BackendFrontend Browser Selenium PhantomJS HTML HTML $_GET,$_POST, $_REQUEST Yii2 Module Backend
  • 24. Different tests types Acceptance Tests Functional Tests Unit Tests Yii2 BackendFrontend Browser Selenium PhantomJS HTML HTML $_GET,$_POST, $_REQUEST Yii2 Module Backend User Scenario
  • 25. Different tests types Acceptance Tests Functional Tests Unit Tests Yii2 BackendFrontend Browser Selenium PhantomJS HTML HTML $_GET,$_POST, $_REQUEST Yii2 Module Backend User Scenario
  • 26. Different tests types Acceptance Tests Functional Tests Unit Tests Yii2 BackendFrontend Browser Selenium PhantomJS HTML HTML $_GET,$_POST, $_REQUEST Yii2 Module Backend User Scenario Developer Scenario
  • 27. Different tests types Acceptance Tests Functional Tests Unit Tests Yii2 BackendFrontend Browser Selenium PhantomJS HTML HTML $_GET,$_POST, $_REQUEST Yii2 Module Backend User Scenario Developer Scenario
  • 28. Different tests types Acceptance Tests Functional Tests Unit Tests Yii2 BackendFrontend Browser Selenium PhantomJS HTML HTML $_GET,$_POST, $_REQUEST Yii2 Module Backend User Scenario Developer Scenario Function Testing
  • 29. Acceptance Tests Enable to do request and interact with the DOM Use a fake browser to perform the queries Can click and fill forms Can be plugged with Selenium/PhantomJS to interact with JavaScript and screenshots Slowest tests to run
  • 30. Functional Tests Same as Acceptance test but does not use a browser engine Can be plugged with the framework to access internal functions and properties (Models, validation) Use $_REQUEST, $_POST and $_GET Faster No DOM interaction (JS/Ajax/Events)
  • 31. Unit Tests Used to test functions Can be plugged with the framework to access internal functions and properties (Models, Validation) Fastest Difficult to use in MVC Not readable by Humans public function testValidation() { $user = User::create(); $user->username = null; $this->assertFalse($user->validate(['username'])); $user->username = 'toolooooongnaaaaaaameeee'; $this->assertFalse($user->validate(['username'])); $user->username = 'davert'; $this->assertTrue($user->validate(['username'])); }
  • 32. Install on all platforms Mac OSX: brew update && brew install homebrew/php/codeception Linux: wget http://codeception.com/codecept.phar . php codecept.phar bootstrap Windows: php composer.phar global require “codeception/codeception:*” Composer/ PhpStorm: php composer.phar require “codeception/codeception:*”
  • 33. Getting ready BootStrap >codecept bootstrap >codecept generate:cept acceptance Validation Edit the configuration file : tests/acceptance.suite.yml class_name: AcceptanceTester modules: enabled: - PhpBrowser - AcceptanceHelper config: PhpBrowser: url: ‘http://conference.kphpug.jp/2015/’
  • 34. Let’s get the party started >codecept run >codecept run —debug Bonus >codecept generate:scenarios acceptance //English version >codecept console acceptance //Interactive console >codecept run —debug —env test
  • 35. Demo Time !!!!! > Let’s test PHP conference Kansai website !
  • 36. Best practices 1. Run tests on your vagrant -> GIT push ONLY when tests pass 2. Deploy on test server -> Validate tests on test server 3. Deploy on production ONLY if tests pass on test server 4. NEVER run on production ! NEVER!!! 1. It creates new entries and change Database 2. Add load on the production server 3. Need new set of tests/monitoring on production
  • 37. References Installation : http://codeception.com/install Acceptance Tests : http://codeception.com/docs/04-AcceptanceTests Yii2 module : http://codeception.com/docs/modules/Yii2 WebDriver : http://codeception.com/docs/modules/WebDriver Yii2 Database Faker : http://qiita.com/tanakahisateru/items/ c4d39cc77a71067ed658 Other tools PHPUnit Framework(Difficult) phpspec (Specification & Unit Testing) Pure Selenium/PhantomJS (Harder integration) Mink (Browser Controlling, slow,harder integration)
  • 38. Questions & Answers Do you have any questions?