One, foreword

In the last article, we looked in detail at Taurus’s regular and Docker installation. In this article, we’ll look at how to get started using Taurus in combination with JMeter for pressure testing.

Introduction to Performance Tools Taurus (Installation)

2. Run existing JMeter scripts

Taurus is capable of supporting the capabilities of existing JMeter (or Grinder or Gatling or Selenium) test engines, as well as directly parsing native scripts such as JMeter JMX files. The default execution engine is JMeter, so if you’ve already created JMX files using JMeter, you can easily run Taurus using the BZT command and the JMX path.

Here I simply use the example script:build-web-test-plan.jmx

Execute command:

BZT example.jmXBzt build-web-test-plan.jmx-o modules.jmeter.version=5.2.1Copy the code

You’ll be able to see a full screen dashboard that contains all Taurus reports. The dashboard has AN ASCII chart showing key statistics and various indicators about the test.

The post-test summary report is as follows:

Note: here I am using the configuration option that can be overridden from the command line with the -o parameter, because the default configuration of JMeter version 5.1 will report error 404 cannot download because the mirror site no longer exists.

The error message is as follows:

Mirror address:Mirrors.tuna.tsinghua.edu.cn/apache/jmet…

We demonstrated running the JMX file directly above, but for YAML, passing the JMX file into Taurus is also a fairly simple process:

Write exist_jmx_conifg. Yml:

settings:
  env:
    BASE_DIR: /home/taurus/taurus_container_scripts   # Script directory
  artifacts-dir: /home/taurus/taurus_container_artifacts/simple1/%Y-%m-%d_%H-%M  # path where to save artifacts, default is %Y-%m-%d_%H-%M-%S.%f
  
execution:
- scenario: simple1   # Scene name

scenarios:
   simple1:
        script: '${BASE_DIR}/build-web-test-plan.jmx'  # script

modules:
    jmeter:
        download-link: 'https://mirrors.tuna.tsinghua.edu.cn/apache//jmeter/binaries/apache-jmeter-{version}.zip' # download address
        version: 5.21.  # version number

reporting:
- module: final-stats   # Summary report
- module: console       # console

Copy the code

Create JMeter scripts using YAML

If you don’t want to use JMeter to create the script, you can also use Taurus’s simple configuration syntax to describe the test scenario using YAML or JSON to describe the JMeter script. This is the test as code we want.

For example, a simple test with 10 concurrent users, a startup time of 1 minute, a duration of 2.5 minutes, and an HTTP GET request to access the example.com site looks simple:

Write the example.yml script:

settings:
  env:
    BASE_DIR: /home/taurus/taurus_container_scripts  # Script directory
  artifacts-dir: /home/taurus/taurus_container_artifacts/simple1/%Y-%m-%d_%H-%M  # path where to save artifacts, default is %Y-%m-%d_%H-%M-%S.%f
  
scenarios:
  my_scenario:
    requests:
      - label: Home
        url: /       # path
        method: GET  # Request mode

execution:
- concurrency: 10  # Number of concurrent threads
  ramp-up: 1m      # Start time
  hold-for: 2m30s  # Duration
  scenario:        # Test scenario
    default-address: http://www.example.com/  # Request address
    requests: 
      - include-scenario: my_scenario  # Scene name

reporting:  
- module: final-stats # Summary report
- module: console     # console

modules:
    jmeter:
        download-link: 'https://mirrors.tuna.tsinghua.edu.cn/apache//jmeter/binaries/apache-jmeter-{version}.zip' # download address
        version: 5.21.  # version number
Copy the code

Run command:

bzt example.yml
Copy the code

After the Enter key is pressed, the Taurus engine will begin executing the test.

Here is how Taurus test execution is displayed:The post-test summary report is as follows:The generated process file is as follows:

[root@localhost 2019-12-28_12-15]# lltotal 3352 -rw-r--r--. 1 root root 23716 Dec 28 12:18 bzt.log -rw-r--r--. 1 root root 6572 Dec 28 12:18 effective.json -rw-r--r--. 1 root root 5336 Dec 28 12:18 effective.yml -rw-r--r--. 1 root root 83 Dec 28 12:18 error.jtl -rw-r--r--. 1 root root 877 Dec 28 12:15 example.yml -rw-r--r--. 1 root root 436 Dec 28 12:15 jmeter-bzt.properties -rw-r--r--. 1 root  root 0 Dec 28 12:15 jmeter.err -rw-r--r--. 1 root root 2858758 Dec 28 12:18 jmeter.log -rw-r--r--. 1 root root 365 Dec 28 12:18 jmeter.out -rw-r--r--. 1 root root 484169 Dec 28 12:18 kpi.jtl -rw-r--r--. 1 root root 815 Dec 28 12:15 merged.json -rw-r--r--. 1 root root 608 Dec 28 12:15 merged.yml -rw-r--r--. 1 root root 7810 Dec 28 12:15 modified_requests.jmx -rw-r--r--. 1 root root 5704 Dec 28 12:15 requests.jmx -rw-r--r--. 1 root root 23 Dec 28 12:15 system.propertiesCopy the code

Document description:

  • Bzt. log: Taurus log file. Contains all output from Taurus, useful for troubleshooting;
  • Json: the final configuration file in Taurus JSON format. It contains merged input files, configuration defaults, any overridden properties, etc.
  • Effective. Yml: andeffective.jsonSame, but in YAML format. Taurus doesn’t distinguish between YAML and JSON and can use any format, so either is fine.
  • Errors. JTL: JMete result file in XML format with all diagnostic fields enabled. The ability to view full request and response details in the View Result Tree listener;
  • Example. yml: YAML configuration file provided to Taurus through the command line.
  • Jmeter-bzt. properties: any JMeter property overridden;
  • Jmeter. log: a very default JMeter log file;
  • Kkp.jtl: Key results file whose name stands for Key performance indicators, which include:
    • Sampler time stamp, label and duration
    • Response message and code
    • Whether the sampler was successful
    • Connection and latency metrics
    • Active thread number
  • Merged. Json: Taurus configuration file. It contains a merged, user-provided configuration file (YAML or JSON), but no default or alternative values are applied;
  • Merged. Yml: same as above, but in YAML format;
  • Modified_requests:requests.jmxSame, and through YAML Taurus driven changes;
  • Requests. JMX: Converts the YAML configuration file toJMeter.jmxFormat;
  • System.properties: Valid JVM system properties.

As noted earlier, for JMeter, Taurus provides the following reports:

  • Summary console at runtime
  • Statistics at the end of the test;
  • 2. JTL result files:
  • CSV- suitable for successful samplers;
  • XML- failure sampler that contains full details of the request/response;

Thus, KPE.jtl and errors. JTL are used for result analysis, while the others are used for debugging purposes.

Note:

On the Intranet, you can download the latest Version of JMeter (with the latest plug-in) to the ~ /.bzt/ Jmeter-Taurus folder. (If you use a custom plug-in, there is an option to specify an existing JMeter location.)

Four, summary

The whole idea of Taurus is to provide a unified, simplified way to configure and run automated tests, and to present the results in the most efficient form. The overall steps are as follows:

  • According to the providedexample.ymlTo prepareJMeter.jmxThe script.
  • Start the actual JMeter pressure test;
  • Display real-time statistics and basic ASCII graphs in the text console;
  • Print the summary to the console after the test is complete;
  • Save JMeter test results out of the box and fromJMeter Plugins The provided JMeter listener can understand the format.

Example script:

  • Github.com/zuozewei/bl…