plugin development – Sample — test — data for large WordPress install
I’m working on a plugin, Index WP MySQL for Speed. For testing it would be helpful to have a very large WordPress installation containing many thousands of posts, pages, metadata entries, media items, users, options, and so forth. The meaning of the data doesn’t matter — it can be lorem ipsum text — but having a lot of it would be great. For my purposes I don’t care whether the media files in wp-content/uploads are available. I just want to bring my test installation’s MySQL database server to its knees.
It would be great if it were a WooCommerce test site.
(I’m aware of the theme unit test data file at https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml. But it’s not big enough for my specific purpose.)
Is there some such importable dataset available? Is there some sort of tool I can leave running for many hours to generate random data? If it comes to that, how would I create such an automated content production tool?
If I must generate my own load test dataset I’ll definitely GPL it.
Answer ( 1 )
Few built-in wp-cli generate commands from the docs:
# Generate posts with fetched content. # See https://developer.wordpress.org/cli/commands/post/generate/ $ curl -N http://loripsum.net/api/5 | wp post generate --post_content --count=10 # Add meta to every generated term. # See https://developer.wordpress.org/cli/commands/term/generate/ $ wp term generate category --format=ids --count=3 | xargs -d ' ' -I % wp term meta add % foo bar # Add meta to every generated comment. # See https://developer.wordpress.org/cli/commands/user/generate/ $ wp comment generate --format=ids --count=3 | xargs -d ' ' -I % wp comment meta add % foo bar # Add meta to every generated users. # See https://developer.wordpress.org/cli/commands/user/generate/ $ wp user generate --format=ids --count=3 | xargs -d ' ' -I % wp user meta add % foo bar
You can also write your own wp-cli package.
Then there are custom wp-cli packages like wp-cli-faker (I’m unrelated to it).