Coming Soon: WooCommerce Testing Guide

We recently conducted a survey asking you how we can make the WooCommerce platform better for developers. One of the insights we discovered from the results of that survey is that a majority of respondents feel there could be more information about testing the extensions they build for WooCommerce. We’re excited to share that we are working on something that can help change that.

The teams within Automattic who maintain WooCommerce are collaborating on an authoritative guide that covers all things related to testing in WooCommerce. The guide will be similar to the updated Extension Developer Guide that we recently rolled out, with one small difference: we plan to publish sections as they’re completed instead of publishing the entire guide at once.

The long-term goal is for these published guides to be living documents that we continually curate as the platform evolves, so we’re going to iterate and improve sections as we collect feedback from developers on what is most helpful and what we could make better.

With that in mind, we’d like to start collecting feedback today. We’re hard at work writing some initial sections, but we’d love to hear from you to make sure we’re focused on impactful topics. Here’s a sneak peek at the outline we’re using to put together each section.


Testing extensions and maintaining quality code: our working outline

Introduction

  • A brief explanation of this guide and what it aims to provide to readers.

The Value of Automated Testing

  • Automated testing is an accepted best practice in software development, but its usefulness is often taken as self-evident — making it harder for individual developers to really understand and feel the value. This section will show when testing provides benefits and what those benefits are, backed by research.
  • We’re drawing inspiration from the WordPress testing docs in an effort to align with the broader community and ecosystem, but we’re also tailoring this guidance to WooCommerce’s goal of providing a high-quality merchant experience.

Types of testing

  • Smoke testing
  • End-to-End Testing
  • Unit testing
  • API testing
  • Performance testing
  • Manual testing
  • Visual Regression Testing

Testing tools

Environment management

  • Docker
  • Homebrew
  • VVV
  • wp-env
  • wp-cli
  • @woocommerce/e2e-environment

Test runners, frameworks, and libraries

  • PHPUnit
  • Jest
  • Puppeteer
  • @woocommerce/e2e-core-tests
  • @woocommerce/e2e-utils
  • @woocommerce/api

Linting and consistency tools

  • PHP Codesniffer
  • ESLint

Debugging tools

  • Xdebug
  • Query Monitor
  • Debug Bar
  • Enabling WP DEBUG logging
  • Mail Poet Email Logging plugin
  • WordPress and WooCommerce Beta Tester Plugins
  • REST API clients
  • React Developer Tools

Setting up a testing environment for an extension

  • Dependencies
  • Architecture
  • Workflow

Best practices for writing and running tests

Critical Flows

  • What are critical flows?
  • Identifying an extension’s critical flows
  • Testing critical flows
  • Maintaining critical flows over time

Unit Testing

  • Setting up PHPUnit

End to End Testing

  • Using the WooCommerce E2E-boilerplate project
  • Setting up WooCommerce E2E tools

Setting up Linting

  • Setting up PHP Codesniffer and WooCommerce Sniffs
  • Setting up ESLint for JavaScript

Is there something we missed? What about topics you think we should cover more thoroughly? Is there a particular tool or concept that you’d like to see included in this testing guide? Drop us a line in the comments below or reach out to us in the WooCommerce Community Slack. We look forward to hearing from you.


Keep yourself in the loop!

Sign up for the WooCommerce developer newsletter:
Hidden
Hidden
Hidden


2 responses to “Coming Soon: WooCommerce Testing Guide”

  1. eCommerce Tools Avatar
    eCommerce Tools

    I think this is a great initiative.

    Please think about cases when you have to test that your plugin supports some other Woo plugin. I.e. plugin X works with plugin Y and with WooCommerce Subscriptions.

  2. […] on the lookout for a dedicated developer guide on testing and quality for all the things you’re building with WooCommerce. We’re publishing it incrementally […]

Leave a Reply

Your email address will not be published. Required fields are marked *