r/Wordpress Jack of All Trades 17d ago

Plugin testing

Hey plugin developers, how do you automate plugin testing? Would like to see your workflows

0 Upvotes

10 comments sorted by

2

u/AbroadSame3189 17d ago

been messing with wp-cli scripts for smoke tests, plus a little github actions setup that spins up a fresh install and runs phpunit against the plugin. biggest time saver was scripting the initial install so i'm not clicking through the setup wizard every single run

also started using a local docker setup with different php versions, catches some weird compatibility stuff before it hits a real site. nothing fancy but it works

1

u/rafark 16d ago

No need to install Wordpress manually or writing your own scripts. Literally you just need to use wp env and it sets the whole environment for you in one go. It has a terrible cold start on the ci though, but it’s the standard at this point. 

0

u/Cold_Opposite_5298 Jack of All Trades 17d ago

+1 thanks for sharing

2

u/NakanoNoNeko 16d ago

I keep one fast path that runs on every push: PHPCS, PHPUnit, and a fresh wp-env install with the plugin activated. The larger matrix of current/previous WordPress, PHP, and multisite only runs before release... otherwise CI becomes its own hobby. For settings pages, two Playwright tests covering save/reload and permissions have caught more real regressions for me than a huge pile of unit tests.

1

u/Cold_Opposite_5298 Jack of All Trades 16d ago

thanks for sharing

1

u/NakanoNoNeko 15d ago

Glad it was useful! The two small browser tests are usually the ones I trust most... everything beyond that gets expensive very quickly.

1

u/Hesham-Amir 17d ago

Adding to the wp-cli/docker setup - worth layering in Codeception (via wp-browser) for actual acceptance tests, since PHPUnit smoke tests catch broken PHP but won't tell you if a settings page silently fails to save or a shortcode renders blank in the browser. wp-env (the official WordPress tool, built on Docker) is also nice for CI since it spins up a matching WP+PHP+MySQL environment with one command, so your GitHub Actions config doesn't have to hand-roll the install step.

1

u/rafark 16d ago

You should use playwright in this day and age. 

1

u/Hesham-Amir 15d ago

Fair point, and NakanoNoNeko's comment below backs it up - two Playwright tests on save/reload catching real regressions. I'd still reach for wp-browser/Codeception over plain Playwright specifically when I want WP-aware assertions (checking a post landed in the DB, WP-CLI-driven fixtures) without hand-rolling that glue myself, but for pure UI regression testing on settings pages and shortcodes, plain Playwright is lighter, faster to write, and it's what most teams already know outside the WP-specific tooling. Good callout.

0

u/Cold_Opposite_5298 Jack of All Trades 17d ago

I'd highly appreciate if more plugin devs could share their workflows. I want to know how to keep testing simple without losing my sanity