Woo testing

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Woo testing is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.

How to use this skill

Skill file

WooCommerce Testing

Before writing code

Fetch live docs:

  1. Web-search site:developer.woocommerce.com testing for WooCommerce testing guide
  2. Web-search site:developer.wordpress.org plugins testing for WordPress Plugin testing handbook
  3. Web-search woocommerce e2e testing playwright for E2E patterns

Test Types

Unit Tests

Isolated class/function testing:

Integration Tests

Tests with WordPress + WooCommerce loaded:

E2E (End-to-End) Tests

Browser-based tests with Playwright:

Setting Up PHPUnit Tests

Scaffold with WP-CLI

wp scaffold plugin-tests my-plugin creates:

WooCommerce Test Bootstrap

After WordPress test bootstrap, load WooCommerce and your plugin:

// In tests/bootstrap.php
require_once dirname( __DIR__ ) . '/vendor/woocommerce/woocommerce/tests/legacy/bootstrap.php';
// Or manually: activate WooCommerce, then your plugin

WC_Unit_Test_Case

Base class providing:

Test Helpers

WC_Helper_Product

Factory for creating test products:

WC_Helper_Order

Factory for creating test orders:

WC_Helper_Customer

WC_Helper_Shipping

WC_Helper_Coupon

Testing Patterns

Testing Hooks

Verify your hooks fire correctly:

Testing CRUD Operations

  1. Create an object (product, order, etc.)
  2. Perform operations (update, delete, query)
  3. Assert expected state
  4. Cleanup happens automatically via transaction rollback

Testing REST API Endpoints

Use WP_REST_Server to dispatch requests:

Testing Payment Gateways

Mocking

E2E Testing with Playwright

Setup

WooCommerce uses @woocommerce/e2e-utils and Playwright:

Common E2E Flows

Best Practices

Fetch the WooCommerce testing documentation and WordPress testing handbook for exact helper methods, bootstrap setup, and E2E configuration before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.