Test Driven Magento Extension Development
Test Driven Magento Extension Development
Test Driven Magento Extension Development

This book is 60% complete

Last updated on 2015-11-01

About the Book

Testing let alone TDD has always been a difficult, and often neglected topic in the Magento ecosystem.

The Magento developer community has approached testing in many different ways and, as a result, some meaningful solutions have been created, such as MageSpec, BehatMage, and Ecomdev's PHP Unit integration.

That being said; testing is still a rare practice among Magento developers, not surprising considering that building proper tests for a Magento extension can be difficult for even seasoned veterans, let alone developers just getting started.

In this book, we attempt to lower the barrier to entry for building testable and high-quality extensions using TDD techniques and principles, and in a way where is easy to build on and keep your testing skills growing.

As well, this book aims to offer a practical reference for any Magento developers looking to develop extensions using a test-first oriented approach.


Some of the concepts and tools used in the book can be daunting at first, especially for developers without previous testing experience.

For that reason, this book is split into two sections: 

In the first part of the book, we go over the theory and introduce the tools and techniques used in the rest of the book. We also dive into the advantages and challenges of testing Magento extensions.

In the second part, we change gears and take a hands-on approach applying the techniques and tools that we learned before to build  some of the most common types of Magento extensions like:

  • Payment Gateways
  • Shipping Methods 
  • Extending the Backend

By the end of the book, readers will be able to build efficiently and test their own Magento extensions using any of the frameworks and tools covered in this book.

Developers will also gain a much deeper and clear understanding of the TDD techniques and principles and how they can relate to their Magento development workflow.

About the Author

Allan MacGregor
Allan MacGregor

Allan MacGregor is a developer living and working in Toronto. Originally from Mexico, he freelanced his way through college before moving to Canada, in 2010. While he designed and developed dozens of projects with clients large and small, specializing in ecommerce websites; during that time he was one of the early adopters of Magento.

In early 2012, he moved to Toronto to work at Demac Media as Magento Lead Developer. Since joining Demac Media, Allan has worked on numerous projects and integrations with payment and shipping gateways, developed several internal tools, dozens of Magento stores and has recently started focusing more on a TDD approach and methodology for Magento development.

You can also follow him on Twitter at @allanmacgregor and read his blog at coderoncode.com

Authors have earned$8,704,777writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub