SlideShare a Scribd company logo
On all Fronts
Testing
Magento
San Francisco Magento Meetup Group - March 11, 2014
Fabrizio
BrancaLead System Developer at
E-Commerce:
Magento
CMS:
TYPO3
Portals:
ZF, FLOW,…
Mobile Searchperience:
SOLR
120 people
in 7 offices
world-wide
High
Performance
/Scale
Global
Enterprise
Projects
Unit
Service
UI
Acceptance
http://www.mountaingoatsoftware.com/blog/the-forgotten-layer-of-the-test-automation-pyramid
What the
customer thinks
the code should do
What the
developer thinks
the code should do
Load
Test
Continuous
Integration
Deployment
Development
Delivery
Improvement
Quality Assurance
Continuous
Everything sounds better
with “continuous”
“Continuous”
==“Doingstuffoverandoveragain”
Builds
Deployment Tests Infrastructure
Setup
Devbox
Setup
== “Automation”
timespent
task size
does it
manually
does it
manually
gets annoyed
writes script to
automate
runs script
wins
loses
Geeks vs. Non-Geeks
Makes fun of geek’s
complicated method
— Ovidiu Platon
We are not shipping your machine!
if it works on your machine!
I don’t care
Picture
The BIG
Vagrant
Boxes
Awesome
stuff
Every single
line potentially
can break
production!
Bratwurst
(Germans)
Donut
(Americans)
Pizza
(Italians)
Version Control
GIT, SVN,…
PHP lint
Version Control Code Reviews
Gerrit, Crucible,
Phabricator,…
Code Reviews Build
Files
DB
Installer
Settings
Triggered by
commit, by time
or manually
Jenkins
minify js/css
.tar.gz
“virtual package”
(revision)
Version Control Code Reviews Build
Files
DB
Installer
Settings
Build
Files
B
ler
Settings
Static Code
Analysis
CodeSniffer
php-pmd
php-cpd
php-depend
Static Code
Analysis
Install on
“Integration”
First system where
code from all
developers/teams
meets each other
unstable system.
Might be broken.
Will be rebuild
without warning
Install on
“Integration”
Unit Tests
PHPUnit
Code
coverage
Unit Tests Integration Tests
Test features that rely on other
parts (e.g. framework, external
services,…)
External components
(SSL, Redis, Varnish,…)
Basically this is also
PHPUnit, but
addressing other stuff
Integration Tests Acceptance Tests
Acceptance Tests
Install on
“Staging”
Behat
(Cucumber)
Same setup as production,
but different machines
Client QA /
approval
Install on
“Staging”
*http://www.slideshare.net/aoemedia/performance-measurement-and-tuning
Stress
Tests
Jmeter
Spin up EC2
instances in the
cloud to produce
traffic*
Stress
Tests
Install on
“Production”
Install on
“Production”
Enable Features
Version
Control
Code
Reviews
Build Static Code
Analysis
Install on
“Integration”
Unit Tests Integration
Tests
Acceptance
Tests
Install on
“Staging”
Install on
“Production”
Enable
Features
with EcomDev_PHPUnit
Unit Tests
https://github.com/EcomDev/
EcomDev_PHPUnit
use the
“dev”
branch!
Config Model Block Helper Controller
fat model,
skinny controller…
Classes
PHPUnit_Framework_TestCaseEcomDev_PHPUnit_Test_Case
EcomDev_PHPUnit_Test_Case_Config EcomDev_PHPUnit_Test_Case_Controller
Assertions
Fixtures
Mocks
Data Provider
Magento Integration
Testsuite
management
Framework
integration
Create test
environment
(db+config)
Manual
http://www.ecomdev.org/2011/05/24/ecomdev_phpunit-manual-version-0-2-0-is-available-for-
download.html
Video tutorial
http://www.ecomdev.org/2012/01/31/test-driven-magento-development-seminar-video-and-
code.html
Documentation
More Information
With Selenium
Acceptance Testing
Acceptance Tests
What’s out there?
Selenium for PHP
PHPUnit_Selenium
(Sebastian Bergmann)
WebDriver-PHP
(Chibimagic)
Php-webdriver-bindings
(Lukasz Kolczynski)
php-webdriver
PHPUnit_Selenium
(Giorgio Sironi)
php-webdriver
Selenium 2
08/2011 Facebook/php-webdriver (Justin Bishop)
Element-34/php-webdriver (Adam Goucher)
instaclick/php-webdriver (Anthon Pang)
php-webdriver
“A very thin wrapper
of WebDriver”
So what?
A thin layer good!
But not enough…
no test logic
no higher level
components
dealing with
Selenium specific tasks
not compatible to
legacy test cases
No abstraction /
structure
Architecture
HTTP
AUT
No direct access
(DB, classes,…)
REST*
(over HTTP)
*http://code.google.com/p/selenium/wiki/JsonWireProtocol
Magento Testing on all fronts
Project test cases
PHPUnit
Project Components
Components Library
Menta
php-webdriver
reusable
project
specific
Menta
Selenium 2 Testing Framework for PHP
Who is
“Menta”?
What is
“Menta”?
Features
MentaThe framework.
Not the cat…
Components Session Management
?Bonus Features :)Event / ObserverConfiguration Management
PHPUnit integration
Why?
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
Data Providers
✔
✔
✔
✔
✔
✔
✔
✔
✔
Dependent Tests
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
Test Infrastructure
Menta for PHPUnit
Abstract test class
PHPUnit_Framework_TestCaseMenta_PHPUnit_Testcase_Selenium2ProjectY_Abstract_TestCase
Very thin layer on
top of PHPUnit
ProjectY_TestCase_Registration ProjectY_TestCase_Checkout
the “magic” happens
in the components
HTML ReportScreenshots
(on demand
and on failure)
test description
from phpdoc
additional
messages
error details
HTML Report“Duration
Heatmap”
shows long
running tests
Menta for PHPUnit
Text Result PrinterPHPUnit 3.7.20 by Sebastian Bergmann.
Configuration read from /var/www/Tests/Acceptance/conf/devfb.ff.vmhost.xml
> SUITE:
> SUITE:
> SUITE: Acceptance_Tests_Account_Register
> TEST: Acceptance_Tests_Account_Register::register
SUCCESS. (Duration: 8.18 sec)
> TEST: Acceptance_Tests_Account_Register::login
SUCCESS. (Duration: 6.5 sec)
> TEST: Acceptance_Tests_Account_Register::testRegistrationMail
FAILURE: Searching for mail with subject 'Welcome, Test_705b077a962977e1a412696ea42249ae User_705b077a962977e1a412696ea42249ae' timed out (Duration: 22
< Duration: 36 sec
< Duration: 36 sec
> SUITE:
> SUITE: Acceptance_Tests_Checkout_CheckoutMultiAddressTest
> TEST: Acceptance_Tests_Checkout_CheckoutMultiAddressTest::putProductsInCart
FAILURE: Element "//table[@id="shopping-cart-table"]//h3[contains(concat(' ', @class, ' '), ' attentionText ')]" does not contain text "Bulb Vase" Fail
< Duration: 9.87 sec
> SUITE: Acceptance_Tests_Checkout_CheckoutTest
> TEST: Acceptance_Tests_Checkout_CheckoutTest::categoryView
SUCCESS. (Duration: 1.79 sec)
> TEST: Acceptance_Tests_Checkout_CheckoutTest::putPlatterInCart
FAILURE: Failed asserting that two strings are equal. (Duration: 3.55 sec)
SKIPPED: This test depends on "Acceptance_Tests_Checkout_CheckoutTest::putPlatterInCart" to pass. (Duration: 5.34 sec)
Components
Common Assert Wait Screenshot Selenium1Facade
Imap WebService W3C Validator Curl …
Some might not even
require a Selenium session
Components!
PageObjects?
PageObjectsComponents
{ }}⊇{ PageObjects are
components
PageObjects?
represents
services offered by
a page or feature
is the only thing with
a deep knowledge of
the HTML
clickCheckoutButton() isInCart($product) getTotals()
✔
✔
✔
Component
Libraries
Menta
Magento
(your library)
Project-
specific
Magento
(community-provided)
General
(your library)
Gallery
Screenshot
Perceptual diffs
Build X
Build X-1
Perceptual
Diff
github.com / AOEmedia / Menta
github.com / AOEmedia / Menta_SampleProject
It’s composer based and
you’ can get started
in a few minutes!
Magento Testing on all fronts
With JMeter
Load Testing
JMeter
jmeter.apache.org
Current version:
2.11
JMeter
HTTP
Simple Setup
JMeter
Slave
JMeter
Slave
JMeter
Slave
JMeter
Master
Master/Slave Setup
JMeter
Slave
JMeter
Slave
JMeter
Slave
JMeter
Master
EC2 Setup
JMeter
Slave
JMeter
Slave
…
Creating
JMeter tests
JMeter
Test
Manually
Replaying Apache
Logs
Recording
Browser
interaction using
a proxy“Convert” existing
acceptance tests
CSV Files
(Selenium)
HTT
HTT
Behat Selenium Firefox Proxy
JMeter
Test
Converting
Behat to JMeter
Using a Proxy
JMeter
Using a Proxy
Browser configuration
Manual
configuration
Browser
Extension
Using a Proxy
Browser configuration
java -jar selenium-server-standalone-2.40.0.jar
-trustAllSSLCertificates
-Dwebdriver.firefox.profile=jmeter
Using a Proxy
Selenium configuration
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
https://wiki.apache.org/jmeter/TestRecording210
http://jmeter.apache.org/usermanual/component_reference.html#HTTP%28S%29_Test_Script
_Recorder
Using a
Proxy
https://jmeter.apache.org/usermanual/test_plan.html
• ThreadGroups
• Controllers
• Samplers
• Logic Controllers
• Test Fragments
• Timers
• Assertions
• Configuration Elements
• Pre-Processor Elements
• Post-Processor Elements
Elements of a
Test Plan
http://www.slideshare.net/shubelal/abj-meterbrief-upladed/7
Elements of a
Test Plan
• Tree structure
• Inheritance (Cookie Manager, Header Manager,…)
• Timers
• Variables
• Assertions
• Random values
• Scripting
• Extracting values
• Following redirects
• (check examples in bin/examples)
Basic Concepts
Workflows
Search / Filters
Static Pages
404
What to testConsider
conversion rate /
funnel!
JMeter
Plugins
jmeter-plugins.org
Magento Testing on all fronts
Distributed
load testing
General Master/Slave setup
https://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.pdf
AOE presentations
http://www.slideshare.net/axeljung01/jmeter-and-amazon-cloud-workshop-t3dd2012
http://www.slideshare.net/aoemedia/performance-measurement-and-tuning
On EC2
https://github.com/oliverlloyd/jmeter-ec2
http://www.http503.com/2012/run-jmeter-on-amazon-ec2-cloud/
Magento Testing on all fronts
Magento Testing on all fronts
Server Monitoring
Thank you!
Any questions?
http://www.aoe.com
http://www.fabrizio-branca.de
@fbrnc
Follow me on twitter!
My blog

More Related Content

PDF
Rock-solid Magento Deployments (and Development)
PDF
Continuous Quality Assurance using Selenium WebDriver
 
PDF
Continuous Integration @ MeetMagento Germany 2015
PDF
Continuous Development and Deployment: Workflows and Patterns
PDF
Continuous Integration and Deployment Patterns for Magento
PDF
Magento and Continuous Integration - Damian Luszczymak
PDF
How to Build a Pure Evil Magento Module
PDF
Establish reliable builds and deployments with Magento
Rock-solid Magento Deployments (and Development)
Continuous Quality Assurance using Selenium WebDriver
 
Continuous Integration @ MeetMagento Germany 2015
Continuous Development and Deployment: Workflows and Patterns
Continuous Integration and Deployment Patterns for Magento
Magento and Continuous Integration - Damian Luszczymak
How to Build a Pure Evil Magento Module
Establish reliable builds and deployments with Magento

What's hot (20)

PDF
Multithreaded XML Import (San Francisco Magento Meetup)
 
ODP
Browser Exploitation Framework Tutorial
PDF
Read me
PPTX
Xdebug, KCacheGrind and Webgrind with WampServer
PDF
How do I Write Testable Javascript so I can Test my CF API on Server and Client
PDF
Web (dis)assembly
PDF
I can be apple and so can you
PDF
2013 10-28 php ug presentation - ci using phing and hudson
PPTX
Your Script Just Killed My Site
PDF
A Introduction to the World of Node, Javascript & Selenium
PDF
High Performance JavaScript 2011
PDF
Composer - The missing package manager for PHP
PDF
Os Fitzpatrick Sussman Swp
PDF
DevDay 2016: Dave Farley - Acceptance testing for continuous delivery
PDF
Implementing CI CD UiPath Using Jenkins Plugin
PDF
Macdoored
PDF
Os Alrubaie
PPTX
Playing in the SharePoint SandBox
PDF
Advances in BeEF - AthCon2012
PPTX
WebSocket on client & server using websocket-sharp & ASP.NET Core
Multithreaded XML Import (San Francisco Magento Meetup)
 
Browser Exploitation Framework Tutorial
Read me
Xdebug, KCacheGrind and Webgrind with WampServer
How do I Write Testable Javascript so I can Test my CF API on Server and Client
Web (dis)assembly
I can be apple and so can you
2013 10-28 php ug presentation - ci using phing and hudson
Your Script Just Killed My Site
A Introduction to the World of Node, Javascript & Selenium
High Performance JavaScript 2011
Composer - The missing package manager for PHP
Os Fitzpatrick Sussman Swp
DevDay 2016: Dave Farley - Acceptance testing for continuous delivery
Implementing CI CD UiPath Using Jenkins Plugin
Macdoored
Os Alrubaie
Playing in the SharePoint SandBox
Advances in BeEF - AthCon2012
WebSocket on client & server using websocket-sharp & ASP.NET Core
Ad

Similar to Magento Testing on all fronts (20)

PDF
Continuous Quality Assurance using Selenium WebDriver
PDF
The PHP Way Of TDD - Think First, Code Later
PDF
Continuous Integration, Deploy, Test From Beginning To End 2014
PDF
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
PDF
Automated Testing Talk from Meet Magento New York 2014
PDF
Yet Another Continuous Integration Story
PPTX
Automated tests
PDF
MidCamp 2014 - A Perfect Launch, Every Time
PPTX
Magento2.3 API Functional Testing
PDF
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
PDF
Clean & Dirty Acceptance Tests with Cucumber & Watir
PDF
Testing in Laravel Framework
PDF
Use Jenkins For Continuous Load Testing And Mobile Test Automation
PPTX
Magento applications and modules functional testing
KEY
Continuous Integration, the minimum viable product
PPTX
Dot all 2019 | Testing with Craft | Giel Tettelar
PDF
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
PDF
2010 07-28-testing-zf-apps
PDF
Code Coverage for Total Security in Application Migrations
PDF
Unit testing for WordPress
Continuous Quality Assurance using Selenium WebDriver
The PHP Way Of TDD - Think First, Code Later
Continuous Integration, Deploy, Test From Beginning To End 2014
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
Automated Testing Talk from Meet Magento New York 2014
Yet Another Continuous Integration Story
Automated tests
MidCamp 2014 - A Perfect Launch, Every Time
Magento2.3 API Functional Testing
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Clean & Dirty Acceptance Tests with Cucumber & Watir
Testing in Laravel Framework
Use Jenkins For Continuous Load Testing And Mobile Test Automation
Magento applications and modules functional testing
Continuous Integration, the minimum viable product
Dot all 2019 | Testing with Craft | Giel Tettelar
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
2010 07-28-testing-zf-apps
Code Coverage for Total Security in Application Migrations
Unit testing for WordPress
Ad

More from AOE (20)

PDF
Re-inventing airport non-aeronautical revenue generation post COVID-19
PDF
Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019
PPTX
Flamingo presentation at code.talks commerce by Daniel Pötzinger
PDF
A bag full of trust - Christof Braun at AOE Conference 2018
PDF
Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...
PDF
Frankfurt Airport Digitalization Case Study
PDF
This is what has to change for Travel Retail to survive - Manuel Heidler, AOE
PDF
AOEconf17: Application Security
PPTX
AOEconf17: AOE Tech Radar Insights
PDF
AOEconf17: A flight through our OM³ Systems
PDF
AOEconf17: AOE Tech Radar Insights
PDF
AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...
PPTX
AOEconf17: Agile scaling concepts
PDF
AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...
PDF
AOEconf17: UI challenges in a microservice world
PDF
AOEconf17: Application Security - Bastian Ike
PPTX
AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...
PDF
AOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan Rotsch
PDF
Joern Bock: The basic concept of an agile organisation
PPTX
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Re-inventing airport non-aeronautical revenue generation post COVID-19
Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019
Flamingo presentation at code.talks commerce by Daniel Pötzinger
A bag full of trust - Christof Braun at AOE Conference 2018
Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...
Frankfurt Airport Digitalization Case Study
This is what has to change for Travel Retail to survive - Manuel Heidler, AOE
AOEconf17: Application Security
AOEconf17: AOE Tech Radar Insights
AOEconf17: A flight through our OM³ Systems
AOEconf17: AOE Tech Radar Insights
AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...
AOEconf17: Agile scaling concepts
AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...
AOEconf17: UI challenges in a microservice world
AOEconf17: Application Security - Bastian Ike
AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...
AOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan Rotsch
Joern Bock: The basic concept of an agile organisation
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
Teaching material agriculture food technology
PPTX
A Presentation on Artificial Intelligence
PPTX
Machine Learning_overview_presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Approach and Philosophy of On baking technology
PPTX
Cloud computing and distributed systems.
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Empathic Computing: Creating Shared Understanding
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation theory and applications.pdf
sap open course for s4hana steps from ECC to s4
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Teaching material agriculture food technology
A Presentation on Artificial Intelligence
Machine Learning_overview_presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Approach and Philosophy of On baking technology
Cloud computing and distributed systems.
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Empathic Computing: Creating Shared Understanding
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation theory and applications.pdf

Magento Testing on all fronts