Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tricks for using JMeter with Drupal
Branch: master

Drupal JMeter Tricks

Author: Erik Webb


  • JMeter 2.12+ [Download]
    • Ensure the jmeter script is in your PATH and executable
  • JMeter Plugins [Download]
  • A Drupal 7 site

Test Site Setup

To setup a simple site for testing these JMeter scripts, use the following Drush commands -

drush site-install --account-name="admin" --account-pass="admin" \
    --site-name="Drupal JMeter Test" standard
drush user-create user --password="user"


> rake -T
rake analyze  # Perform log analysis on JMeter results
rake clean    # Remove current log and results files
rake edit     # Open JMeter script for editing
rake json     # Save the results.jtl file as JSON
rake run      # Run JMeter script and save results


  • test.jmx: Sample JMeter test script with multiple thread groups to illustrate different techniques. The following scenarios are used as examples -
    1. Drupal Login: Login as a Drupal user, driven by a CSV file.
    2. Select From A List: View a content listing and select a single item at random to view.
    3. Traverse Menu Tree: Visit every page located in the main menu.
    4. Create a Node: Save a new piece of content using hard-coded values.
    5. Visit List of URLs: Visit every URL listed in a CSV file.
    6. Visit List of 404 URLs: Visit every 404 URL listed in a CSV file.
    7. Clear Cache: Login as an admin and clear the Drupal caches.
  • Properties needed for a usable results file.
  • Rakefile: Rake file to shortcut common tasks.
  • users.csv: Sample user dictionary file
  • urls.csv: Sample list of URLs to test against

NOTE: In order to optimize resource utilization, only a Simple Data Writer listener is used. The fields stored in results.jtl file are configured using


There are a few configuration settings that require specific note here -

  1. XPath query used to detect a Drupal error message -

    //div[contains(concat(' ',normalize-space(@class),' '),' messages ') and contains(concat(' ',normalize-space(@class),' '),' error ')]
  2. Choosing a random item from a JMeter list returned by the XPath Post Processor -

  3. Check if a variable was successfully set -

    "${node_links}".length > 0


If you have run into issues, please post an issue on Github and attach your jmeter.log file.

Something went wrong with that request. Please try again.