Magento Testing - London Magento User Group, December Meetup
Upcoming SlideShare
Loading in...5
×
 

Magento Testing - London Magento User Group, December Meetup

on

  • 4,861 views

My presentation about Magento Testing, 4th of December 2013, London Magento User Group, December Meetup. ...

My presentation about Magento Testing, 4th of December 2013, London Magento User Group, December Meetup.

You can test any aspect of Magento. Having a continuous integration process in place and test coverage will give your development team confidence to release new functionality even on a Friday afternoon.


Florinel is currently co-founder and Chief Service Officer at Elastera (http://www.elastera.com), a cloud-based Platform as a Service for Magento e-commerce sites.

Statistics

Views

Total Views
4,861
Views on SlideShare
4,767
Embed Views
94

Actions

Likes
5
Downloads
12
Comments
0

4 Embeds 94

https://twitter.com 62
http://www.redditmedia.com 15
http://www.linkedin.com 11
https://www.linkedin.com 6

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Magento Testing - London Magento User Group, December Meetup Magento Testing - London Magento User Group, December Meetup Presentation Transcript

    • Testing Magento Florinel Chis @florinelchis London Magento User Group – December Meetup
    • whoami Co-Founder and Chief Service Officer - Development Lead at Warner Music - 11 years in e-commerce - Magento since 2008
    • Magento Testing • Unit Testing – Tools – EcomDev_PHPUnit • Functional Testing (CasperJS) • Performance Testing – Web page performance testing – XHProf, Aoe_Profiler • Resources
    • Unit Testing • Available tools: – plain phpunit – MTAF – EcomDev_PHPUnit – TechDivision_MagentoUnitTesting – Mage-Test
    • Plain phpunit • Test API calls • Test libraries • Other basic tests • Any other aspect of Magento that is not dependent on things like session • Requires lots of effort in “setUp()”
    • EcomDev_PHPUnit • Integrated with Magento • Supports Fixtures • You can test pretty much any aspect of Magento (Controllers, Models, Layout, Config, etc)
    • Database settings • app/etc/local.xml.phpunit <phpunit> <allow_same_db>?</allow_same_db> </phpunit> • 0 – Requires a separate db for the tests • 1 – You can use the same db that Magento uses (local.xml) Note: Fixtures will delete all existing records (@see ::apply() function in Fixture/Processor/*)
    • Module Structure #Namespace/Module/etc/config.xml <phpunit> <suite> <modules> <Namespace_Module /> </modules> </suite> </phpunit> #Test files: Namespace/Module/Test/PathTo/Class.php Namespace/Module/Test/fixtures/*.yaml Namespace/Module/Test/expectations/*.yaml Namespace/Module/Test/providers/*.yaml
    • Testing Emails • Extend Mage_Core_Model_Email_Template • Mailcatcher.me (+API)
    • Mage_Core_Model_Email_Template Mage::getConfig()->setNode( 'global/models/core/rewrite/email_template', 'Namespace_Test_Model_Email_Template' ); // This is a hack to get the runtime config changes to take effect Mage::getModel('core/email_template'); $mailTemplate = Mage::getModel('core/email_template'); //… do your stuff Note: https://github.com/MageTest/Mage-Test is the inspiration for this approach
    • Mailcatcher configuration $ gem install mailcatcher $ mailcatcher php.ini: sendmail_path = /usr/bin/env catchmail -f mail@example.com #REST API: /messages /messages/1.plain /messages/1.json
    • Mailcatcher
    • CI Integration • jenkins-php.org • Book: Integrating PHP Projects with Jenkins by Sebastian Bergmann
    • Examples • Unit Test Demo
    • Functional Testing with CasperJS “CasperJS is an open source navigation scripting & testing utility” • Writtern for PhantomJS or SlimerJS • Good for “writing functional test suites, saving results as JUnit XML” • Other cool features: take screenshots, test remote DOM, scrape web documents
    • ‘No more CAPTCHAs, end robot discrimination’
    • Why CasperJS • Friendly • Javascript • Quick • Simple
    • Performance testing • Web Page – webpagetest.org – PageSpeed – YSlow – other tools • Magento
    • • CI Integration – webpagetest.org API – PhantomJS + YSlow
    • PhantomJS + YSlow phantomjs yslow.js http://yslow.org phantomjs yslow.js -i grade -f xml www.yahoo.com www.cnn.com www.nytimes.com phantomjs yslow.js --info all --format plain --ua "MSIE 9.0" http://yslow.org phantomjs yslow.js -i basic --rulseset yslow1 -d http://yslow.org phantomjs yslow.js -i grade -b http://www.showslow.com/beacon/yslow/ -v yslow.org phantomjs --load-plugins=yes yslow.js -vp 800x600 http://www.yahoo.com phantomjs yslow.js -i grade -f tap -t 85 http://yslow.org
    • CSS Testing • CSSLint • PhantomCSS
    • CSSLint • csslint --warnings=box-model,ids filename.css – [--format=junit-xml | checkstyle-xml]
    • PhantomCSS • https://github.com/Huddle/PhantomCSS
    • PhantomCSS Tips • Avoid dynamic data (homepage menu, banners) • Use version control for the base pictures (and make sure you update them when they should change) • Use the same OS/browser/viewport
    • Magento Performance - XHProf “XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based user interface.” Magento modules: Demac_Xhprof and Liip_Xhprof
    • Aoe_Profiler https://github.com/fbrnc/Aoe_Profiler
    • Where to go from here? • https://github.com/EcomDev/EcomDev_PHPUnit • http://netzarbeiter.com/media/mm13/ • https://github.com/Vinai/test-frameworks-mm13de • https://github.com/lilmuckers/magento-lilmuckers_queue • https://github.com/MageTest • https://github.com/fbrnc/Aoe_Profiler • https://github.com/facebook/xhprof • http://magento.stackexchange.com/ • http://casperjs.org/
    • Questions?
    • Thank you. @florinelchis http://www.linkedin.com/in/chisflorinel