Continuous Integration shortens time to release and ensures easy test configuration maintenance — but testing can be complicated. This blog post will go over how to run a load test through Taurus and any open-source tool and how to run those tests through Jenkins pipelines. This blog post is based on a webinar I co-presented with CloudBees and DevOps.com, which you can view here.
Taurus is an easy-to-use open source testing framework that works as a command line tool. Taurus simplifies load testing of 9 open-source load and functional testing tools: JMeter, Selenium, Gatling, The Grinder, Locust, Tsung, Siege, Apache Bench, and PBench. However, you don’t need to learn any of these tools’ complicated syntax. Rather, you can use Taurus’ intuitive YAML syntax instead.
Taurus doesn’t support LoadRunner because LoadRunner isn’t an open-source tool. To learn more about converting your scripts from LoadRunner to open-source, see here.
Creating a Taurus Script
First, install Taurus.
Then, create your script in YAML. Let’s look at this simple script:
--- execution: - concurrency: 10 hold-for: 5m ramp-up: 60s scenario: Thread Group scenarios: Thread Group: requests: - label: blazedemo method: GET url: http://blazedemo.com/ - body: fromPort: Paris toPort: Buenos Aires label: reserve method: POST url: http://blazedemo.com/reserve.php
As you can see, it’s pretty easy to understand. This script runs 10 concurrent users and holds the load for five minutes. The ramp-up is 20 seconds and the thread group runs two requests: a
GET request to blazedemo.com and a
POST request to blazedemo.com/reserve.php.
Unless you specify an executor by adding a line that says executor: Gatling (for example), Taurus will use JMeter as the default executor. In the back, Taurus will create an artifact directory with a JMX file (or a Scala file if you run Gatling, a Python file if you run Selenium, etc.). If you have pre-configured scripts for your open-source tools, that’s OK. Just add a path to them in the script and add the test configurations within the YAML.
You can also add pass/fail criteria. For example:
--- services: - module: passfail criteria: - avg-rt>10ms for 7s, stop as failed - hits of reserve >10 for 13s, continue as failed
In this case, if the average response time is more than 10ms for seven seconds, the test will stop as failed — or, if the number of hits is more than 10 for 13 seconds, the test will continue as failed. I created these parameters on purpose so the test will fail.
Now run the test by typing:
bzt <file_name>.yml <pass_fail_file_name>.bzt
Viewing Taurus Results
You can quickly and easily see the test results on the Taurus dashboard. Note the failure alerts on the top right.
Viewing Taurus Results on BlazeMeter
You can also view the test results on BlazeMeter. To do that, run:
bzt <file_name>.yml -report
BlazeMeter will open up and you will be able to conduct a deeper analysis based on rich and colorful reports. BlazeMeter is a SAAS platform and you can also configure different geo-locations and higher concurrencies.
Here, for example, I configured engines to run from AWS Virginia and North California with 500 virtual users.
BlazeMeter offers different reports, which you can learn more about here.
Integrating Taurus With Jenkins
After opening Jenkins, create a pipeline script. Here, I am pulling the YAML scripts from my GitHub repository and running the same command that I ran locally to run your Taurus test.
To run the test in the cloud, modify the location parameters in the YAML script. You can also easily modify other configs, like concurrency or ramp-up.
Jenkins can run these tests automatically. You can configure how the test runs in the build section. Here, for example, the test runs each time a change is pushed in GitHub; every time I change the concurrency, for example, the test will run again.
You can see the results in Jenkins:
Or open the BlazeMeter link and see the results in BlazeMeter in real-time:
BlazeMeter also supports APM tools like New Relic, CloudWatch, and CA APM. You can configure them through BlazeMeter and they will run on your Taurus test. You will get the metrics in the BlazeMeter report.
That’s it! You now know how to use Jenkins to run your YAML test, which runs open-source load testing through Taurus.