I had a suite of jMeter tests that needed to be automated as part of a continuous integration setup, I used fabric and jenkins to achieve this.
Different websites to performance test automatically, running from the same third party application. Along with similar tests to run for each website, and site specific tests.
Before explaining how it’s all setup, this is the directory structure used for the tests
As you may have geussed, view_page.jmx and view_page.csv are releated.
The .jmx is a jmeter test that relies on the csv to run the tests. The csv contains a URL to test, and a value to check on the page.
Notice the variable names, url_key,text_to_test
These are the values that jMeter expects to find in the csv for example
user_login.jmx is used for testing the account sections of our sites, it’s a test that carries out a post request to the login form of a web application.
In the fabric script, I set it up so that any test can use a csv data set. The csv file just needs to exist in the correct website test folder, and be named after the test file.
The build takes three main parameters: users, loops, and the ramp up period. It uses the git module to pull the latest code from a hosted repository, then executes a fabric script using the shell command.
The jMeter plugin we use provides some basic reporting graphs which are useful.
This show’s me how response time of a widely used page has improved per build, the jenkins builds detail the changes too.
The fabric script
The essence of this script is to run jmx files found in the directories listed above. I use the command line arguments to setup parameters for the tests.
In the scenario where a test needs to be excluded from the automated running process, append .inactive to the file name and it will be ignored.