Taurus
Taurus
Taurus is an open-source performance testing tool that simplifies the creation, execution, and analysis of performance tests. It supports various testing tools and integrates well with modern CI/CD pipelines. This guide covers installation on Linux, running Taurus with Docker, and provides several example scripts to help you get started.
Taurus install linux
To install Taurus on a Linux system, follow these steps:
sudo yum install java-1.8.0
sudo yum remove java-1.7.0-openjdk
sudo yum install python default-jre-headless python-tk python-pip python-dev \
libxml2-dev libxslt-dev zlib1g-dev net-tools
sudo yum -y install gcc
sudo yum install bzt
Running Taurus with Docker
You can run Taurus using Docker for an isolated environment. Here’s how:
docker run --rm -v C:\ccviews\taurus:/bzt-configs -v C:\ccviews\taurus\artifact:/tmp/artifacts blazemeter/taurus taurus_execution.yml
Replace /path/to/taurus/config with the directory containing your Taurus configuration files, and /path/to/taurus/artifacts with the directory where you want to save the test artifacts.
Example Scripts
Here are several example Taurus scripts to illustrate different scenarios and configurations.
Demo Script 1
execution:
- scenario: testlogin
concurrency: 170
hold-for: 50s
duration: 60
scenarios:
testlogin:
headers:
Content-type: application/json
User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'
requests:
- url: https://
method: POST
label: '/signin'
body:
'username':
'password':
assert-jsonpath:
- jsonpath: "$.ErrorNo" # path to value, validation fails if path not exists
validate: true # validate against expected value
expected-value: "0" # the value we are expecting to validate, default: false
regexp: true # if the value is regular expression, default: true
expect-null: false # expected value is null
invert: false # invert condition
reporting:
- module: console
- module: final-stats
summary: true
percentiles: true
failed-labels: false
test-duration: true
Description:
- Simulates 170 users for 50 seconds, then maintains 10 users for 60 seconds.
- Posts a login request and checks the response for an expected error code.
- Reports are generated on the console and include final statistics with percentiles.
Demo Script 2
execution:
- scenario: testlogin
concurrency: 300
hold-for: 3000s
duration: 1000
scenarios:
testlogin:
headers:
Content-type: application/json
User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'
requests:
- url: https://
method: POST
body:
'username':
'password':
reporting:
- final-stats
- console
Description:
- Simulates 300 users for 3000 seconds, then performs a load test for 1000 seconds.
- Posts login requests and generates a report with final statistics and console output.
Demo Script 3
execution:
- scenario: test
concurrency: 2
hold-for: 10s
duration: 2
scenarios:
test:
headers:
Content-type: application/json
requests:
- url: https://******/api/
method: GET
extract-jsonpath:
masterEventIds: $.result.
eventIds: $.result.
- url: https://******/api/
method: GET
label: bpe
assert-jsonpath:
- "$[0].quantity"
reporting:
#- module: blazemeter
# report-name: testbpe
# test: testbpe
# project: testbpe
- module: passfail
criteria:
- avg-rt of bpe>100ms for 10s, stop as failed
- rc4?? of bpe>1, stop as failed
- rc5?? of bpe>1, stop as failed
Description:
- Runs a scenario with 2 users for 10 seconds, testing API endpoints.
- Extracts JSON values and checks conditions against response time and status codes.
- Uses a pass/fail reporting module based on custom criteria.
Monitoring and Integration
For more advanced monitoring and integration, you can use tools such as Grafana and InfluxDB. Here are some useful resources:
Creating a Lightweight Performance Monitoring Solution with Docker, Grafana, and InfluxDB
Gatling Tests Monitoring with Grafana and InfluxDB
Taurus with Docker
- Create folder name taurus
- Create sub folder name artifact
docker run --rm -v C:\ccviews\taurus:/bzt-configs -v C:\ccviews\taurus\artifact:/tmp/artifacts blazemeter/taurus taurus_execution1.yml