Realistic Dummy Content for Drupal Test Sites
Skill level: easy
Developers, themers, and site administrators who need content for testing are all familiar with the indispensable module called Devel, which contains a dummy content generation function. This is the tool that creates pages of Latin text -- and those familiar and annoying color blocks that act as placeholders for images.
It’s handy to have content automatically generated for you, but if you’re showing sample pages to a client or to your marketing team, it doesn’t make the best impression. That’s why I’m giving a big thumbs up for the Realistic Dummy Content module, a project that came out of the Let's generate kick-ass demo content issue posted on Drupal forums. The module generates dummy content and uses portraits and stock photography as image placeholders. Since it leverages the Devel module, you can just use the Drush generate-content (genc) command as usual or use the Devel user interface from Drupal.
How to use Realistic Dummy Content
If you haven’t used Devel before to generate dummy content, here’s how to do it and get better results with realistic content.
Install Realistic Dummy Content. If you don’t have the Devel module, you will also need to install that. Once installed, the modules will all show up under the list of Devel modules and you will need to enable them.
There are two ways to use these modules: the Devel user interface or Drush.
Generate content using the Devel UI:
Go to Configuration, where you’ll see a long list of options under Development. Generate Content is one of them.
The Generate Content interface offers a number of options to set before you press GENERATE:
- You can generate content for all content types or select for specific content types
- You can delete all content of a certain content type before generating new content (reminder: this is for test sites)
- You can specify how many nodes to generate and how far back the node creation dates should go
- You can specify the maximum number of dummy comments for each node that supports comments
- You can set the maximum number of words for the title of each node
Generate content using Drush
The generate-content command, also known as genc, accepts two arguments:
drush genc number_nodes maximum_comments
Example: for 50 nodes with a maximum of 4 comments per node:
$ drush genc 50 4
It also accepts a number of options. These are the most frequently used:
--kill: deletes all content before generating new content
$ drush genc 50 4 --kill
--types: content types to create, a comma delimited list. If not used, genc defaults to page and article.
$ drush genc 50 4 --types=latest_news, article
For a complete list of options, check out the this page about the generate-content command.
Helpful hint: if a taxonomy and tags are defined, generate-content will assign tags at random. Therefore if you create terms and vocabularies first and then generate content, you will end up with more useful test data. Devel can generate terms and vocabularies automatically, but they will be in fake Latin. I find it’s better to create your own terms because it makes testing easier when you have a meaningful taxonomy to work with.
Below are a couple of articles with text and images populated by Realistic Dummy Content. Much, much nicer and more meaningful.
Themers and developers are accustomed to visualizing beyond color blocks, but when you’re showing sample pages of content to clients or users during the early stages of a project, realistic images make a huge difference. Devel and Realistic Dummy Content make it easy to generate fake content that looks good – which makes it easier to communicate design and functionality to clients. If you want to know how Smartt’s development methodology ensures meaningful client feedback at each critical stage of the project, contact us.