3 Quick Ways to Create bbPress Test Data

bbPress 2.5 introduced a host of new importers for AEF, Drupal, FluxBB, Kunena Forums (Joomla), MyBB, Phorum, PHPFox, PHPWind, PunBB, SMF, Xenforo and XMB, making it easier than ever to bring forums into WordPress. bbPress 2.5 also improved existing importers to include better support for importing stickies, topic tags, and forum categories.

If you’re thinking about importing forums into bbPress or starting with a fresh installation, you may want to set up a test site first to see how different themes and plugins will work with your content. There’s nothing more tedious than trying to create a bunch of forums, topics, and replies manually, so you’ll need an automatic way to generate a bunch of demo data.

In searching for bbPress demo data, I found that there’s no standard way to generate it. Several developers have created and shared their own tools. Depending on your development workflow, one method may prove easier than another, so we’ll check out all three.

XML: bbPress Unit Testing Data

The first option is a set of bbPress unit testing data stored in an XML file, which allows you to import it via the standard WordPress import tool. The file was created by bbPress core commiter Stephen Edgar. It gives you 17 forums, including 15 public, 1 private, and 1 hidden.

The demo data includes multiple topics and replies and also a group of forums and categories based on the Nested set model.

Technically, this unit testing data is still in process, as it’s currently hosted in a ticket on bbPress trac and is open to further improvement.

Plugin: bbpFauxData

bbpFauxData is another option created by WordPress developer Daniel Dvorkin. It’s a quick and dirty plugin to help you populate a bbPress instance with faux data which seems real, generated by the Faker PHP library, in order to test performance.

Once installed, you can set how many users, forums, topics and replies that you want to generate:
[php light=”true”]
$bfd = new bbpFauxData();

const USERS = 50;
const FORUMS = 5;
const TOPICS = 100;
const REPLIES = 1000;

for ( $i = 0; $i < USERS; $i++ ) {
$bfd->generate_user();
}

for ( $i = 0; $i < FORUMS; $i++ ) {
$bfd->generate_forum();
}

for ( $i = 0; $i < TOPICS; $i++ ) {
$bfd->generate_topic();
}

for ( $i = 0; $i < REPLIES; $i++ ) {
$bfd->generate_reply();
}[/php]

This plugin gives you a little more control over how much demo data you want to generate, as it is geared more towards testing performance. Dvorkin suggests that you bump up the ‘max_execution_time’ and ‘memory_limit’, if implementing this data at higher numbers.

Plugin: Test Data for bbPress

Test Data for bbPress is a plugin created by Rob Mehew, who needed demo data while developing a theme. The plugin creates the following:

Adds a forum with nested forums

Adds a forum with loads of topics

Adds a topic with loads of replies

Test Data for bbPress was created for the purpose of testing themes and includes lorem ipsum for sample text. As with all of the above options, this plugin should only be used on a development site; it is not designed for use on a live site.

Anyone have other bbPress demo data creation tools? Let us know in the comments.