Skip to main content

Testing your e-commerce PHP application


I'm participating (as much as possible) in the #30daysoftesting challenge organised by Ministry of Testing and SauceLabs. If you're interested, read the full 30 Days of E-Commerce Testing article and join this fun and educational challenge.

The 2nd challenge on the list was to read and share interesting blog articles about E-commerce testing. Since I'm working as a PHP professional I thought it would be great if I oriented my focus on testing PHP based E-commerce platforms. I picked WooCommerce as it's an easy to install and use E-commerce solution. For Magento, PrestaShop and others I've added useful links at the bottom of this article.


WooCommerce Homepage

WooCommerce is an add-on for WordPress, allowing you to integrate E-commerce functionality directly within your blog. This ensures you can be up-and-running in no-time. Even though WooCommerce and WordPress are very active community-driven projects, they both suffer from legacy that has been carried along with WordPress since it's origin: it wasn't build with testing in mind.

Don't get me wrong, the latest versions of WooCommerce and WordPress have unit tests, but their users and integration community was never engaged to automate tests or have taken on a habit of testing. Both platforms come equipped with all the tools required for automated testing when you check out the development code. Production code for the general public do not include these tests. Maybe that's why there's not such a testing culture on these projects.

WordPress PHPUnit tests
Running PHPUnit tests on WordPress Core

If you like to know more about testing WordPress (and fixing bugs), check out their "Make WordPress Core Handbook" as it will give you step-by-step instructions how to get started testing WordPress.

On top of WordPress sits WooCommerce as a plugin (or add-on). Where WordPress offers a step-by-step guide to prepare for testing, WooCommerce offers a Core Testing Guide on their GitHub Wiki. Setting your environment up for testing WooCommerce is a little bit tricky following their guide only, but luckily Jon Moore has a detailed blog article written for unit and end-to-end testing WooCommerce that you can use as a guide to automatically test your WooCommerce application.

WooCommerce PHPUnit tests
Running PHPUnit tests on WooCommerce

Other PHP E-commerce platforms

As mentioned earlier, there are several other E-commerce platforms besides WooCommerce on WordPress: Magento, PrestaShop, OpenCart, Sylius, Aimeos and many more. I'm not going in detail about their functionality and features, instead I'm more interested in their testing culture and how they allow developers and users to automate their tests.

Magento Testing Resources

PrestaShop Testing Resources

We see that these mentioned E-commerce projects are seeing the importance of testing and are working hard to improve their code coverage. After all, it's in their best interest to ensure that their users can sell and ship products and get paid in return for their products and/or services. Nobody wants to loose money.

But we also see that the adaption of tests by users, integrators or hosting companies is not their primary focus. Doing research to get started with testing a commercial web application is not easy, articles are often out-dated or incomplete. 

Hopefully with this #30daysoftesting initiative by Ministry of Testing and SauceLabs we can get more involvement from the community in testing their E-commerce solutions and make these platforms more robust and resilient.

What are your thoughts? Leave your comments and thoughts below or when communicating over social media use the hashtag #30daysoftesting.


Popular posts from this blog

PHP 7 and Apache on macOS Sierra

I posted several talks about compiling PHP from source, but everyone was trying to convince me that a package manager like Homebrew was a more convenient way to install. The purpose of Homebrew is simple: a package manager for macOS that will allow you to set up and install common packages easily and allows you to update frequently using simple commands. I used a clean installation of macOS Sierra to ensure all steps could be recorded and tested. In most cases you already have done work on your Mac, so chances are you can skip a few steps in this tutorial. APACHE AND PHP WITH HOMEBREW I’ve made this according to the installation instructions given on GetGrav. The installation procedures These installation procedures will set up your macOS Sierra with PHP 7.1 and Apache 2.4. Install Xcode command line tools (if not done yet)xcode-select --install Install Homebrew/usr/bin/ruby -e "$(curl -fsSL" Set up for in…

Sessions in PHP 7.1 and Redis

In case you have missed it, PHP 7.1.0 has been released recently. Now you can’t wait to upgrade your servers to the latest and greatest PHP version ever. But hold that thought a second… With PHP 7 lots of things have changed underneath the hood. But these changed features can also put unexpected challenges on your path. Our challenge One of these challenges that we faced was getting PHP 7.1 to play nice storing sessions in our Redis storage. In order to store sessions in Redis, we needed to install the Redis PHP extension that not only provides PHP functions for Redis, but also installs the PHP session handler for Redis. Because we upgraded our servers to PHP 7.1, we were looking to use the latest provided version for this Redis extension: redis-3.1.0. Once installed, we bumped against a nasty problem. Warning: session_start(): Failed to read session data: redis (path: tcp:// Searching the internet for this error, we didn’t got many hits that could point us into a dire…

VAT Validation now for PHP 7.1+

When I started my European Commission (EC) VAT Information Exchange System (VIES) project back in 2011, PHP 5.3 was the current version that has given us so much. Earlier that year version 5.2 was announced End-of-Life and everyone was excited about the new features in PHP coming with the 5.3.x releases.

But fast-forwarding to today, PHP 7.1 is the latest stable release and PHP 5.6 only gets security fixes until the end of this year. In the mean time several open-source projects like PHPUnitXDebugZend FrameworkLaravelJoomlaTYPO3Magento and Symfony announced they stop development for PHP 5 versions and now only move forward with PHP 7.1 and higher.

After seeing Sebastian Bergmann’s talk PHP 7: Reality Check I was empowered by his reasoning that it’s not worth putting support in outdated PHP versions and focus on the current and future versions that will make a difference in functionality, performance and security.

For this reason I would like to announce that the European …