woo-testing

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.

17 stars

Best use case

woo-testing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using woo-testing should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/woo-testing/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/woocommerce-commerce/.agent/skills/woo-testing/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/woo-testing/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How woo-testing Compares

Feature / Agentwoo-testingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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:
- No WordPress/WooCommerce bootstrap
- Mock all dependencies
- Fast execution
- Test pure business logic

### Integration Tests

Tests with WordPress + WooCommerce loaded:
- Extend `WC_Unit_Test_Case` (which extends `WP_UnitTestCase`)
- Full WordPress database (using transactions for rollback)
- Access to all WooCommerce APIs and hooks
- Test plugin integration with WooCommerce

### E2E (End-to-End) Tests

Browser-based tests with Playwright:
- Test complete user flows (add to cart, checkout, payment)
- WooCommerce provides Playwright utilities
- Run against a real WordPress + WooCommerce instance

## Setting Up PHPUnit Tests

### Scaffold with WP-CLI

`wp scaffold plugin-tests my-plugin` creates:
- `tests/bootstrap.php` — test bootstrap
- `tests/test-sample.php` — sample test
- `phpunit.xml.dist` — PHPUnit configuration
- `bin/install-wp-tests.sh` — install WordPress test suite

### WooCommerce Test Bootstrap

After WordPress test bootstrap, load WooCommerce and your plugin:
```php
// 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:
- Transaction-based test isolation (each test rolled back)
- WooCommerce helper methods
- Proper environment setup/teardown

## Test Helpers

### WC_Helper_Product

Factory for creating test products:
- `WC_Helper_Product::create_simple_product()` — simple product with defaults
- `WC_Helper_Product::create_variation_product()` — variable + variations
- `WC_Helper_Product::create_grouped_product()` — grouped product
- `WC_Helper_Product::create_external_product()` — external/affiliate

### WC_Helper_Order

Factory for creating test orders:
- `WC_Helper_Order::create_order( $customer_id )` — order with line items
- Configurable status, products, addresses

### WC_Helper_Customer

- `WC_Helper_Customer::create_customer()` — customer with address
- `WC_Helper_Customer::create_mock_customer()` — mock customer object

### WC_Helper_Shipping

- `WC_Helper_Shipping::create_simple_flat_rate()` — flat rate shipping zone
- Set up shipping zones and methods for checkout tests

### WC_Helper_Coupon

- `WC_Helper_Coupon::create_coupon()` — discount coupon with configurable type/amount

## Testing Patterns

### Testing Hooks

Verify your hooks fire correctly:
- Check that a callback is registered: `has_action( 'hook_name', [ $instance, 'method' ] )`
- Test the callback's effect by triggering the hook
- Use `did_action( 'hook_name' )` to verify an action fired

### 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:
- `$request = new WP_REST_Request( 'GET', '/wc/v3/products' )`
- `$response = rest_get_server()->dispatch( $request )`
- Assert status code, response data, headers

### Testing Payment Gateways

- Create order, set payment method
- Call `process_payment()` with test credentials
- Assert order status changes
- Test refund flow

### Mocking

- Use PHPUnit mocks: `$this->createMock( ClassName::class )`
- Mock HTTP requests: `add_filter( 'pre_http_request', $mock_response )`
- WooCommerce provides `WC_Mock_Payment_Gateway` and similar mocks

## E2E Testing with Playwright

### Setup

WooCommerce uses `@woocommerce/e2e-utils` and Playwright:
- Configure in `playwright.config.js`
- Tests in `tests/e2e/specs/`
- Page objects for common pages (shop, cart, checkout, my-account)

### Common E2E Flows

- Add product to cart → verify cart → proceed to checkout → complete order
- Customer registration and login
- Admin: create product, manage orders, configure settings
- Payment gateway integration testing

## Best Practices

- Use `WC_Unit_Test_Case` for integration tests
- Use WooCommerce helper classes (`WC_Helper_Product`, etc.) for test fixtures
- Test with HPOS enabled and disabled
- Test with both classic and block checkout
- Mock external API calls (payment processors, shipping carriers)
- Use `@group` annotations for test organization
- Clean up created data (helpers handle this via transaction rollback)
- Run tests in CI with WordPress test suite

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

Related Skills

webmcp-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test WebMCP tools with AI agents — Chrome DevTools integration, agent testing workflows, tool discovery verification, and end-to-end commerce flow testing. Use when validating that tools work correctly with real AI agents.

spree-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test Spree applications and extensions with RSpec — `spree_dev_tools` gem (v5.2+) for factories and helpers, FactoryBot patterns (prefer `build` over `create`), Capybara feature specs, controller/request specs, testing decorators and subscribers, dummy app for extension testing, system specs for the Hotwire admin, and CI patterns. Use when writing Spree tests, setting up CI, or refactoring slow specs.

shopify-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test Shopify applications — app testing with Vitest and Playwright, theme testing with Theme Check, Function testing, webhook testing, extension testing, and CI/CD pipelines. Use when writing tests for Shopify projects.

sf-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test Salesforce Commerce code — B2C (Node.js unit testing, sfcc-ci CI/CD, sandbox management, linting) and B2B (Apex test classes with 75% coverage minimum, Jest for LWC, sf CLI deployment and validation). Use when writing tests or setting up CI/CD.

saleor-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test Saleor applications — pytest setup, Django test client, GraphQL test patterns, App testing, factory_boy fixtures, and webhook testing. Use when writing tests for Saleor projects.

medusa-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test Medusa v2 applications — Jest setup, module unit tests, workflow integration tests, API route tests, medusaIntegrationTestRunner, and mock patterns. Use when writing tests for Medusa projects.

php-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Write PHP tests with PHPUnit — unit tests, mocking, data providers, test doubles, assertions, and TDD practices. Use when writing tests for PHP code, whether in Magento or standalone PHP applications.

magento-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Write tests for Magento 2 — PHPUnit unit tests, integration tests, MFTF functional tests, and API tests. Use when implementing test coverage for modules, debugging, or setting up CI/CD test pipelines.

bc-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test BigCommerce integrations — API testing, Stencil theme testing, Cypress/Playwright E2E tests, webhook testing, and sandbox stores. Use when writing tests for BigCommerce apps, themes, or integrations.

a2a-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test A2A implementations — unit tests, integration tests, mock agents, protocol conformance, and end-to-end multi-agent testing. Use when building test suites for A2A servers, clients, or multi-agent systems.

woo-shipping

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

woo-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Install WooCommerce, configure the development stack, and set up a local dev environment with WP-CLI, Docker, or wp-env. Use when setting up a new WooCommerce project or development environment.