Skip to content

Instantly share code, notes, and snippets.

@technicaldogsbody
Last active November 27, 2018 07:56
Show Gist options
  • Save technicaldogsbody/815aee1f9807f803fdf644969972cc06 to your computer and use it in GitHub Desktop.
Save technicaldogsbody/815aee1f9807f803fdf644969972cc06 to your computer and use it in GitHub Desktop.
Sitemap driven load test

Sitemap Driven Load Test

A Taurus script that will take a sitemap.xml url and use it to randomly load test pages from the xml.

This will only work on Linux (including Bash for Windows).

Install Taurus

https://gettaurus.org/docs/Installation/

sudo apt-get update
sudo apt-get install python default-jre-headless python-tk python-pip python-dev \
  libxml2-dev libxslt-dev zlib1g-dev net-tools
sudo pip install bzt

Install XmlStarlet

sudo apt-get install xmlstarlet

Update the YAML

  • Open sitemap.yml
  • Change the sitemap url on line 5
  • Change the execution setting on lines 10-14
  • Add any additional requests above line 21.

Run Taurus

bzt sitemap.yml -report
services:
- module: shellexec
prepare:
- mkdir -p src
- curl -s https://www.sitemaps.org/sitemap.xml | xmlstarlet sel -N sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" -t -m "sitemap:urlset/sitemap:url" -v 'sitemap:loc' -o ',' -v 'sitemap:lastmod' -n > src/sitemap.csv
- sort -R src/sitemap.csv > src/random_sitemap.csv
- (echo "loc,lastmod"; cat src/random_sitemap.csv) > src/random_sitemap_with_headers.csv
execution:
- concurrency: 10
hold-for: 60s
iterations: 5
ramp-up: 30s
scenario: Sitemap
scenarios:
Sitemap:
data-sources:
- src/random_sitemap_with_headers.csv
requests:
- ${loc}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment