Taurus is an open-source test automation framework designed specifically for load testing. It simplifies the process by using a YAML configuration format instead of complex scripting languages. It integrates seamlessly with popular tools like JMeter and Jenkins, making it a great choice for performance testing within CI/CD pipelines.
This article will guide readers through getting started with Taurus, from setting up their first test to delving into advanced testing scenarios.
Getting Started with Taurus
Installation Prerequisites
Before diving into the installation of Taurus, it’s essential to ensure your system meets the necessary requirements. For a smooth setup, your system should have wheel
, setuptools
, and Cython
installed. Depending on the specifics of the tests you plan to run, additional software such as Java or specific Python tools like Locust might be required. This preliminary step is crucial for avoiding interruptions during the installation process of Taurus.
Installation Steps Across Different Operating Systems
The installation process for Taurus varies slightly depending on your operating system:
- Windows:
- Install Python 3.7 or higher and the latest version of Java.
- Install the latest Microsoft Visual C++.
- Update
pip
,setuptools
, andwheel
using the command:$ python -m pip install --upgrade pip setuptools wheel
. - Finally, install Taurus with:
$ python -m pip install bzt
.
- Mac OS:
- Use Homebrew to install Taurus by running
$ brew install bzt
. - If issues arise with Homebrew, alternatively use pip:
$ pip3 install Cython bzt
- Use Homebrew to install Taurus by running
- Linux:
- Update your package list with
$ sudo apt-get update
. - Install necessary packages using:
$ sudo apt-get install python3 default-jre-headless python3-tk python3-pip python3-dev libxml2-dev libxslt-dev zlib1g-dev net-tools
. - Install Taurus with:
$ python3 -m pip install bzt
.
- Update your package list with
Utilizing Docker for Taurus
For those preferring containerization, Taurus offers a Docker image which simplifies the setup and execution of tests. To use Taurus via Docker:
- Run the command:
$ docker run -it --rm -v /tmp/my-test:/bzt-configs blazemeter/taurus my-config.yml
. - To pass specific command-line options to Taurus, append them at the end of the docker run command.
- Optionally, mount a directory as
/tmp/artifact
s to collect artifacts from Taurus running in the container.
This section ensures you are equipped to install Taurus effectively across different environments and begin leveraging its Taurus capabilities for performance testing.
Creating Your First Test
To initiate your first Taurus load test, particularly using Gatling without prior coding knowledge, follow these streamlined steps:
Step 1: Prepare Your YAML Script
Begin by creating a YAML script that Taurus will execute. You have two main options here:
- Write Manually: Craft your own YAML script by specifying the execution and scenarios sections. The execution part should define Gatling as the tool, set load parameters, and name your test scenario. In the scenarios section, detail each step of the test, including the root URL, the HTTP requests to be made, and any assertions to verify the responses.
- Use Tools for Script Generation: Alternatively, leverage tools like Blazemeter’s Chrome Extension or Proxy Recorder. These tools can record your browser interactions and automatically generate a Taurus-compatible YAML script.
Step 2: Execute the Test
Once your YAML script is ready, it’s time to run the test:
- Save your script as a .yml file on your computer.
- Open your command line interface.
- Execute the test by typing bzt your-script-name.yml. Replace your-script-name.yml with the path and name of your YAML file.
Step 3: Customize and Enhance Your Test
To refine your testing process, Taurus offers extensive customization options in the YAML script:
- Requests and Parameters: Define detailed HTTP request types like GET or POST, and customize headers, payload, or query parameters to enhance your api testing strategy.
- Performance Settings: Adjust the number of concurrent users (threads), ramp-up periods, and the duration of the test (hold-for) to optimize your load configuration and ensure even load distribution.
- Assertions: Set specific rules to validate the responses, ensuring your API behaves as expected under load, which is crucial for identifying failure criteria.
Analyzing Test Results
Real-Time and Post-Test Analysis
Taurus enhances the experience of performance testing by providing real-time feedback and detailed post-test analysis. During test execution, Taurus displays live statistics within the command line terminal, offering immediate insight into the test’s performance, including metrics like response times and error rates. For a more granular analysis, Taurus integrates seamlessly with BlazeMeter, where it can feed test results directly to generate comprehensive reports and graphs. This integration allows users to view detailed performance metrics per test script, making it easier to pinpoint issues and improve test scenarios, thus elevating Blazemeter performance testing, interactive reports, and test reporting.
Dashboard Utility and Reporting Features
The Taurus Dashboard is a powerful tool for both during and after the test execution. It provides a real-time view of the test, showing various metrics that are crucial for assessing the application’s performance under load. After the test concludes, the dashboard displays final statistics, which include average response times and the percentage of failed requests, among other key performance indicators (KPIs). These dashboards are not only informative but also user-friendly and can be easily shared with team members, enhancing collaborative efforts in performance optimization.
Advanced Reporting Options and Integration
For users requiring detailed analysis, Taurus supports various reporting modules and integration options. The default console reporting provides real-time metrics and a summary table after test execution. For a more detailed view, the BlazeMeter reporter uploads all test statistics to the BlazeMeter service, offering an interactive report with in-depth analysis. Additionally, Taurus supports JUnit XML for functional tests and InfluxDB for sending statistics to a database, which is useful for historical performance tracking and deeper analysis. The flexibility in reporting ensures that users can tailor the feedback to meet their specific testing requirements and goals, with options for json-based reporting.
Advanced Testing Scenarios
Implementing Complex Load Patterns
Taurus excels in creating advanced load testing scenarios, such as spike testing, which involves sudden increases or decreases in load to observe how the system behaves under stress. To set up spike testing:
- Define Load Profile: Use the throughput option in your YAML configuration to control the number of requests per second.
- Specify Load Pattern: The
load_profile
property allows you to detail the desired load pattern. This configuration is passed directly to the underlying JMeter engine, utilizing JMeter Properties and Variables for precise control.
Scenario-Based Testing with Token Management
For scenarios requiring authentication, Taurus can handle complexities such as token expiration and renewal within the test script:
- Initial Token Retrieval: Define an authentication scenario that saves the token upon successful execution.
- Token Expiration and Renewal: Configure the YAML file to check the token’s expiry and automatically rerun the authentication scenario to retrieve a new token when necessary. This ensures continuous testing without manual intervention.
Integration and Reporting Enhancements
Taurus supports integration with CI pipelines, including Jenkins, and can generate detailed reports in various formats, such as XML/CSV and Junit XML. These capabilities are vital for continuous integration and real-time performance feedback.
- CI Pipeline Integration: Utilize Taurus’s command-line interface to integrate load testing into your CI pipeline, ensuring that performance benchmarks are met consistently.
- Enhanced Reporting: Configure Taurus to upload test results to BlazeMeter for advanced analysis, or use local reporting options for immediate insights. This integration supports a robust SLA/SLO mechanism based on customizable “pass/fail” criteria, facilitating proactive performance management.
By leveraging these advanced features, Taurus provides a flexible and powerful toolset for handling complex testing scenarios and integrating performance testing into the development lifecycle.