### YAML List Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/YAMLTutorial.md Illustrates how to define a list in YAML. Each list item is indented and starts with a dash followed by a space. ```yaml jedis: - Yoda - Qui-Gon Jinn - Obi-Wan Kenobi - Luke Skywalker ``` -------------------------------- ### Install Robot Framework and SeleniumLibrary Source: https://github.com/blazemeter/taurus/blob/master/examples/selenium/robot/README.md Install the necessary Python packages for Robot Framework and SeleniumLibrary. Ensure Python 3 is installed. ```bash pip install robotframework robotframework-seleniumlibrary ``` -------------------------------- ### Basic Loop Example in Apiritif Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Apiritif.md Demonstrates a basic loop with a variable, start, end, and do block for actions. The loop includes actions that reference the loop variable. ```yaml scenarios: example: browser: Chrome timeout: 10s requests: - label: example_loop actions: - go(http://blazedemo.com) - loop: var_i start: 1 end: 10 do: - clickById(id_${var_i}) - typeById(input_${var_i}): My Item ${var_i} ``` -------------------------------- ### YAML Configuration Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ConfigSyntax.md This is an equivalent Taurus configuration file written in YAML format. It demonstrates the same settings as the JSON example but uses YAML syntax. ```yaml aggregator: aggregator execution: - executor: jmeter scenario: jmx_sample scenarios: jmx_sample: script: tests/jmx/dummy.jmx modules: jmeter: class: bzt.modules.jmeter.JMeterExecutor path: build/jmeter/bin/jmeter properties: jmeter.save.saveservice.autoflush: 'true' provisioning: local reporting: - module: status ``` -------------------------------- ### Taurus Full Configuration Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ConfigSyntax.md This example demonstrates a comprehensive Taurus configuration file touching upon execution, scenarios, reporting, modules, and settings. ```yaml execution: - concurrency: 10 hold-for: 5m ramp-up: 2m scenario: sample scenarios: sample: headers: Connection: close requests: - http://localhost/ reporting: - module: final-stats - module: console modules: jmeter: path: ./local/jmeter properties: log_level: DEBUG console: disable: false settings: check-interval: 5s default-executor: jmeter provisioning: local ``` -------------------------------- ### Basic K6 Script Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/K6.md A simple k6 script that performs an HTTP GET request and then sleeps. Ensure this script is valid and accessible by the k6 executor. ```javascript import http from 'k6/http'; import { sleep } from 'k6'; export default function () { http.get('https://blazedemo.com/'); sleep(1); } ``` -------------------------------- ### Complex Apache Benchmark Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ApacheBenchmark.md A more advanced example showing configuration for concurrency, iterations, keep-alive, custom headers, and nested headers for specific requests. This setup allows for detailed control over the load testing parameters. ```yaml execution: - executor: ab concurrency: 20 iterations: 1000 scenario: complex scenarios: complex: keepalive: false headers: Content-Type: text/plain requests: - url: http://blazedemo.com/ headers: X-Answer: 42 ``` -------------------------------- ### Install Python Packages from Zip and Requirements Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Cloud.md Upload custom Python modules as a zip file and install them along with requirements using `shellexec`. Ensure the zip file is listed in `files` and unzipped before installation. ```yaml execution: - executor: locust scenario: locust-scen files: - my-modules.zip services: - module: shellexec prepare: - unzip my-modules.zip - pip install -r requirements.txt ``` -------------------------------- ### Install Essential Python Packages Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md Before installing Taurus, ensure you have the latest versions of wheel, setuptools, and Cython. This is a prerequisite for a smooth installation. ```bash pip install --upgrade wheel setuptools Cython ``` -------------------------------- ### Basic Siege Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Siege.md A minimal configuration to start using the Siege executor. Ensure Siege is installed and accessible in your system's PATH. ```yaml execution: - executor: siege concurrency: 3 iterations: 10 scenario: simplest scenarios: simplest: requests: - http://blazedemo.com/ ``` -------------------------------- ### JSON Configuration Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ConfigSyntax.md This is an example of a Taurus configuration file written in JSON format. It defines execution parameters, scenarios, provisioning, and reporting modules. ```json { "execution": [ { "executor": "jmeter", "scenario": "sample" } ], "scenarios": { "sample": { "script": "tests/jmx/dummy.jmx" } }, "provisioning": "local", "aggregator": "aggregator", "reporting": [ { "module": "final-stats" } ], "modules": { "jmeter": { "path": "build/jmeter/bin/jmeter", "class": "bzt.modules.jmeter.JMeterExecutor", "properties": { "jmeter.save.saveservice.autoflush": "true" } } } } ``` -------------------------------- ### Simplest Apache Benchmark Scenario Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ApacheBenchmark.md This is the most basic configuration to run Apache Benchmark. Ensure Apache Benchmark is installed and accessible. ```yaml execution: - executor: ab scenario: simple scenarios: simple: requests: - http://blazedemo.com/ ``` -------------------------------- ### Install Tsung with Homebrew Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Tsung.md Use Homebrew to install Tsung on Mac OS X. Ensure Homebrew is installed first. ```bash brew install tsung ``` -------------------------------- ### Included Configs Syntax Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ConfigSyntax.md This example demonstrates the syntax for including other configuration files in Taurus. It shows how to reference local files and remote URLs. ```yaml included-configs: # it must be a list of string values - additional-local-file.yml # to add local file just set its path - http://central.host/mystorage/remote.yml # you can also download config from http/https location ``` -------------------------------- ### YAML Dictionary Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/YAMLTutorial.md Demonstrates the definition of a dictionary (key-value pairs) in YAML. A space after the colon is mandatory for correct parsing. ```yaml jedi: name: Obi-Wan Kenobi home-planet: Stewjon species: human master: Qui-Gon Jinn height: 1.82m ``` -------------------------------- ### Basic Foreach Loop Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Apiritif.md Demonstrates a basic foreach loop to iterate over input elements and perform click and type actions. Use 'el' to refer to the current element. ```yaml scenarios: example: browser: Chrome timeout: 10s requests: - label: example_foreach_1 actions: - go(http://blazedemo.com) - foreach: el # specify the name of the variable that will be used in the actions referring that element locators: - css: input - xpath: //input do: - clickByElement(el) # refers to the variable el - typeByElement(el): text to type - type: storeValue element: el # refers to the variable el param: my_var ``` -------------------------------- ### Install Python Package with Pip Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Cloud.md Use the `shellexec` service in the `prepare` stage to install Python packages via pip. Ensure the package name is correct. ```yaml services: - module: shellexec prepare: - pip install cryptography # 'cryptography' is the library from PyPi ``` -------------------------------- ### Sample Apiritif Scenario Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Apiritif.md A comprehensive example of an Apiritif scenario configuration, including browser settings, timeouts, requests, actions, and assertions. ```yaml scenarios: request_example: browser: Firefox # available browsers are: Firefox, Chrome, Ie, Opera, Edge headless: true # available only for Chrome/Firefox and only on Selenium 3.8.0+, disabled by default timeout: 10 # global scenario timeout for connecting, receiving results, 30 seconds by default think-time: 1s500ms # global scenario delay between each request default-address: http://blazedemo.com/ # specify a base address, so you can use short urls in requests certificate: /path/to/certficate passpharse: "passphrase" # if present requests: - url: / # url to open, only get method is supported actions: # holds list of actions to perform - waitForByCSS(body, present) - clickByID(mySubmitButton) - openWindow(http://blazedemo.com/vacation.html) # new window is created (#1) - resizeWindow(750, 750) # change window size to x, y - maximizeWindow() # change window size to maximum - closeWindow() # close the second window (#1) - pauseFor(5s) - clearCookies() - keysByName(myInputName): keys_to_type - submitByName(myInputName) - waitForByID(myObjectToAppear, visible): 3s - scriptEval("alert('This is Sparta');") - rawCode: print('It\'s Python') # insert as-is into script file - rawCode: | for i in range(10): # multiline example if i % 2 == 0: print(i) - clickByShadow(c-basic,form-opened,#mytext) # sample usage of shadow locator assert: # assert executed after actions - contains: - blazemeter # list of search patterns - Trusted subject: body # only body subject supported regexp: false # treat string as regular expression not: false # inverse assertion condition ``` -------------------------------- ### Install Taurus on Windows using pip Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md After completing the preparation steps on Windows (Python, Java, Visual C++), install Taurus using pip. Ensure Python is in your PATH. ```bash python -m pip install bzt ``` -------------------------------- ### Siege Configuration with RC File Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Siege.md Configure Siege to use a specific rc-file for advanced settings. This example runs 100 concurrent users for 5 iterations. ```yaml execution: - executor: siege concurrency: 100 iterations: 5 scenario: simplest rc-file: path/to/my.siegerc scenarios: simplest: requests: - http://blazedemo.com/ ``` -------------------------------- ### Basic Taurus YAML Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/YAMLTutorial.md This is an example of a typical Taurus configuration file written in YAML, demonstrating its structure for defining execution parameters, scenarios, reporting modules, and settings. ```yaml execution: - concurrency: 10 hold-for: 5m ramp-up: 2m scenario: yaml_example scenarios: yaml_example: retrieve-resources: false requests: - http://example.com/ reporting: - module: final-stats - module: console settings: check-interval: 5s default-executor: jmeter provisioning: local ``` -------------------------------- ### YAML Multi-Document Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/YAMLTutorial.md Demonstrates how to embed multiple YAML documents within a single file, separated by a line containing '---'. Taurus treats each document as a separate configuration. ```yaml document: this is document 1 --- document: this is document 2 ``` -------------------------------- ### Mouse Actions with Single Locator in Apiritif Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Apiritif.md Provides examples of various mouse imitation actions using a single locator syntax. ```yaml - type: click locators: - css: element_class - xpath: /xpath/ - type: doubleClick locators: - css: element_class - xpath: /xpath/ - type: contextClick locators: - css: element_class - xpath: /xpath/ - type: mouseDown locators: - css: element_class - xpath: /xpath/ - type: mouseUp locators: - css: element_class - xpath: /xpath/ - type: mouseOut locators: - css: element_class - xpath: /xpath/ - type: mouseOver locators: - css: element_class - xpath: /xpath/ - type: drag source: - name: element_name - xpath: /xpath/ target: - css: element_css - xpath: /xpath/ ``` -------------------------------- ### Install Taurus on Linux with apt-get Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md This command installs Taurus along with necessary system dependencies like Python 3, Java, and development libraries on Debian-based Linux systems. ```bash sudo apt-get update sudo apt-get install python3 default-jre-headless python3-tk python3-pip python3-dev libxml2-dev libxslt-dev zlib1g-dev net-tools sudo python3 -m pip install bzt ``` -------------------------------- ### YAML Inline Syntax for Lists and Dictionaries Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/YAMLTutorial.md Provides examples of using inline syntax for lists and dictionaries in YAML, which can be more concise for simple collections. ```yaml episodes: [1, 2, 3, 4, 5, 6, 7] best-jedi: {name: Obi-Wan, side: light} ``` -------------------------------- ### Appium Loader Service Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Services.md Configure the appium service to automatically start or stop the Appium server. Specify the path to the Appium executable and an optional timeout for startup. ```yaml services: - appium modules: appium: path: 'path/to/appium/executable' timeout: 20 # timeout for appium startup ``` -------------------------------- ### Self-Executing YAML Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ConfigSyntax.md This example shows how to make a YAML configuration file executable on Linux/macOS by adding a shebang line. This allows you to run the script directly. ```yaml #! /usr/local/bin/bzt execution: - hold-for: 1m scenario: simple scenarios: simple: requests: - http://blazedemo.com/ ``` -------------------------------- ### Run Taurus Script from Command Line Source: https://github.com/blazemeter/taurus/blob/master/site/dat/kb/TeamCity.md Execute a Taurus performance test script using the 'bzt' command. Ensure Taurus is installed and the script path is correct. ```bash bzt [path to the script] ``` ```bash bzt /Users/BlazeMeter/tests/BlazeDemoTest.yml ``` -------------------------------- ### Running Self-Executing YAML Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ConfigSyntax.md This command shows how to execute a self-executing YAML configuration file directly, with an example of overriding a configuration parameter. ```bash ./myscript.yml -o execution.hold-for=5m ``` -------------------------------- ### Update pip, setuptools, and wheel on Windows Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md Before installing Taurus on Windows, update essential Python packaging tools. Ensure Python is added to your system's PATH. ```bash python -m pip install --upgrade pip setuptools wheel ``` -------------------------------- ### Run multiple Taurus config files with Docker Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md Use Docker to run Taurus with multiple configuration files. This example shows how to specify multiple YAML or JSON files, or use wildcards. ```bash docker run -it --rm -v /tmp/my-test:/bzt-configs blazemeter/taurus *.yml docker run -it --rm -v /tmp/my-test:/bzt-configs blazemeter/taurus my-config-1.json my-config-2.json ``` -------------------------------- ### Tsung Basic Concurrency and Hold-for Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Tsung.md Configure Tsung executor with constant concurrency and a fixed duration. This example sets 100 concurrent users for 1 minute. ```yaml execution: - executor: tsung concurrency: 100 hold-for: 1m scenario: sample scenarios: sample: default-address: http://blazedemo.com requests: - / - /reserve.php ``` -------------------------------- ### Basic ShellExec Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ShellExec.md This sample shows a basic configuration for the shellexec service, defining commands for prepare, startup, shutdown, and post-process stages. ```yaml services: - module: shellexec prepare: - mkdir /tmp/test startup: - echo 1 > /tmp/test - echo 2 > /tmp/test shutdown: - cat /tmp/test2 post-process: - rm /tmp/test1 - rm /tmp/test2 execution: - scenario: tg1 hold-for: 10s scenarios: tg1: requests: - label: HTTP Request method: GET url: http://127.0.0.1/ ``` -------------------------------- ### Run Quick Test on URL Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/CommandLine.md Execute a quick test against a specified URL directly from the command line. This is a convenient way to perform a basic load test without a full configuration file. ```bash bzt http://blazedemo.com/ ``` -------------------------------- ### Basic Taurus YAML Test Script Source: https://github.com/blazemeter/taurus/blob/master/site/dat/kb/Scripting.md This is a simple Taurus script defining a basic test scenario with concurrency and ramp-up settings. It's useful for getting started with Taurus. ```yaml execution: - concurrency: 100 ramp-up: 1m hold-for: 1m30s scenario: simple scenarios: simple: think-time: 0.75 requests: - http://blazedemo.com/ ``` -------------------------------- ### Install Cython on macOS for pip installation Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md If you encounter issues with Homebrew installation on macOS, install Cython using pip3 first. This is a prerequisite for installing Taurus via pip. ```bash pip3 install Cython ``` -------------------------------- ### Install Taurus on macOS using Homebrew Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md Install Taurus on macOS using the Homebrew package manager. This is a convenient way to manage installations on macOS. ```bash brew install bzt ``` -------------------------------- ### Minimum ShellExec Task Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ShellExec.md This sample shows the minimum configuration required for a shellexec task, specifying commands for prepare and startup stages. ```yaml services: - module: shellexec prepare: ls -la startup: - pwd - echo something ``` -------------------------------- ### Install Taurus using pip Source: https://github.com/blazemeter/taurus/blob/master/README.md Install or upgrade Taurus using pip. This command installs the latest version of Taurus from the Python Package Index. ```bash pip install bzt ``` -------------------------------- ### Install Taurus on macOS using pip3 Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md Install Taurus on macOS using pip3. This method is recommended if you face issues with the Homebrew installation, especially concerning numpy. ```bash pip3 install bzt ``` -------------------------------- ### Schedule Execution with Specific Start Time Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ExecutionSettings.md Use the `start-at` parameter to schedule an execution to begin at a specific date and time. Supported time formats include YYYY-MM-DD HH:MM:SS, YYYY-MM-DD HH:MM, HH:MM:SS, and HH:MM. ```yaml execution: - concurrency: 10 hold-for: 20s start-at: '2020-03-25 23:15' # must be string scenario: sample scenarios: sample: requests: - http://blazedemo.com/ ``` -------------------------------- ### Install Python Packages with Pip-Installer Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Services.md Use this snippet to install specific Python packages, including version constraints. The `temp` parameter controls whether packages are installed in a temporary location or shared across launches. ```yaml services: - module: pip-install packages: - one - two==0.0.0 - name: three version: 0.0.0 modules: pip-install: temp: false ``` -------------------------------- ### Store JavaScript Evaluation Result Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Apiritif.md Stores a boolean indicating if an element is present, determined by JavaScript evaluation. This is an example of using storeEval. ```javascript storeEval(document.getElementById("elem_id") !== undefined): el_present ``` -------------------------------- ### Module Settings Shorthand Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ConfigSyntax.md Illustrates the shorthand notation for specifying module classes directly as strings, which Taurus expands into a full dictionary. ```yaml modules: final-stats: bzt.modules.reporting.FinalStatus ``` ```yaml modules: final-stats: class: bzt.modules.reporting.FinalStatus ``` -------------------------------- ### Configure Load Settings for Local and Cloud Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Cloud.md Use a notation to configure 'concurrency' and 'throughput' for both 'local' and 'cloud' provisioning simultaneously. This allows seamless switching between local debugging and cloud execution without modifying load settings. ```yaml execution: - scenario: my-scen concurrency: local: 5 cloud: 5000 throughput: local: 100 cloud: 10000 ``` -------------------------------- ### Basic Services Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Services.md Configure services like shellexec and monitoring by listing them under the top-level 'services' section. Specify module type and relevant parameters. ```yaml services: - module: shellexec post-process: ls /tmp - module: monitoring server-agent: - address: 127.0.0.1:4444 metrics: - cpu - disks - memory ``` -------------------------------- ### JMeter Set Variables Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/JMeter.md The set-variables block allows you to dynamically change JMeter variable values during test execution. This example shows updating a variable between iterations. ```yaml scenarios: set_vars_example: variables: foo: BAR requests: - http://blazedemo.com/?foo=${foo} - set-variables: foo: BAZ ``` -------------------------------- ### YAML Unquoted String Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/YAMLTutorial.md Shows an example of an unquoted string in YAML. This is convenient for simple string values but requires quoting if the string contains special characters. ```yaml unquoted-string: Hello World ``` -------------------------------- ### InfluxDB Datapoint Example Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Reporting.md An example of a datapoint structure sent to InfluxDB, including time, measurement, fields, and tags. The reporter uses seconds as epoch for the time attribute. ```json { "time": 1666575154, "measurement": "jmeter", "fields": { "countError": 21 }, "tags": { "application": "myapp", "transaction": "all", "status": "all" } } ``` -------------------------------- ### Quick Test YAML Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/sample-scripts/quick_test.yml.md This YAML configuration defines the execution parameters such as concurrency, ramp-up, and hold duration, along with the test scenario. ```yaml execution: - concurrency: 100 ramp-up: 1m hold-for: 5m scenario: quick-test scenarios: quick-test: requests: - http://blazedemo.com ``` -------------------------------- ### Launch Cloud Test via CLI Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Cloud.md Launches a cloud test directly from the command line using the `bzt` command and specifying the test URL. ```bash $ bzt -cloud -o modules.cloud.test=https://a.blazemeter.com/app/#/accounts/97961/workspaces/89846/projects/132315/tests/5817816 ``` -------------------------------- ### Define Pass/Fail Criteria Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/PassFail.md Example of setting up pass/fail criteria using the passfail module in Taurus configuration. This example includes criteria for average response time and failure rate, with actions to stop the test as failed. ```yaml reporting: - module: passfail criteria: - avg-rt of IndexPage>150ms for 10s, stop as failed - fail of CheckoutPage>50% for 10s, stop as failed ``` -------------------------------- ### Loop with Variable Start, End, and Step in Apiritif Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Apiritif.md Shows how to use variables within the start, end, and step fields of a loop. This allows for dynamic loop ranges and steps, including string concatenation for numeric values. ```yaml scenarios: example: browser: Chrome timeout: 10s variables: step: 1 end: '00' requests: - label: example_loop actions: - go(http://blazedemo.com) - loop: i start: '1' end: '1${end}' # will result in 100 step: ${step} do: - clickById(id_${i}) ``` -------------------------------- ### JMeter Keystore Configuration Log Output Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/JMeter.md Example log output confirming JMeter's Keystore configuration, including preload status, indices, alias variable name, and total aliases loaded. ```log INFO o.a.j.c.KeystoreConfig: Configuring Keystore with (preload: 'True', startIndex: 0, endIndex: 99, clientCertAliasVarName: 'certalias') INFO o.a.j.u.JsseSSLManager: Using default SSL protocol: TLS INFO o.a.j.u.JsseSSLManager: SSL session context: per-thread INFO o.a.j.u.SSLManager: JmeterKeyStore Location: /tmp/test-data/my-client-certificates-in-one-jks.jks type JKS INFO o.a.j.u.SSLManager: KeyStore created OK INFO o.a.j.u.SSLManager: Total of 100 aliases loaded OK from keystore ``` -------------------------------- ### Install JMeter gRPC Plugin Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/JMeter.md Add the jmeter-grpc-request plugin to your JMeter configuration. ```yaml modules: jmeter: plugins: - jmeter-grpc-request ``` -------------------------------- ### Customize Mocha Tools Directory Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Mocha.md Configure the 'tools-dir' module setting in Taurus to customize the directory where Mocha and its dependencies are installed. ```yaml modules: mocha: tools-dir: my-dir ``` -------------------------------- ### Siege Configuration with Script and Think-Time Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Siege.md Test URLs from a specified file with a set number of users and a hold-for duration. Includes a think-time delay between requests. ```yaml execution: - executor: siege concurrency: 50 hold-for: 5m scenario: external_urls scenarios: external_urls: think-time: 15s script: ~/tests/nodes.list ``` -------------------------------- ### Custom Selenium Server Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/JUnit.md Provide custom download links, versions, or paths for the Selenium Server if not using the default. ```yaml modules: junit: selenium-server: download-link: http://my.own.host.com/selenium-server.jar version: 1.2.3 path: /some/place/on/disk/selenium-server.jar ``` -------------------------------- ### Configuring Apache Benchmark Path and Cmdline Options Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ApacheBenchmark.md This snippet shows how to specify a custom path to the Apache Benchmark executable using the `path` option and pass additional command-line arguments via `cmdline`. This is useful if `ab` is not in your system's PATH. ```yaml modules: ab: path: /home/john/build/apache2/bin/ab cmdline: -e csv-file ``` -------------------------------- ### Schedule Executions with Delay Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/ExecutionSettings.md Introduce a `delay` to start subsequent executions after a specified time. This allows for staggered test runs. ```yaml execution: - concurrency: 10 hold-for: 20s scenario: main - concurrency: 20 hold-for: 15s scenario: main delay: 10s scenarios: main: requests: - http://blazedemo.com/ ``` -------------------------------- ### Upgrade Taurus on Linux with apt-get Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Installation.md To upgrade Taurus on Linux systems using apt-get, run this command to install the latest release. ```bash sudo python3 -m pip install --upgrade bzt ``` -------------------------------- ### Taurus YAML for Pre/Post Test Actions Source: https://github.com/blazemeter/taurus/blob/master/site/dat/kb/ShellexecHooks.md This configuration demonstrates how to define pre-test actions in 'prepare' and 'startup' and post-test actions in 'shutdown' and 'post-process' within a single Taurus YAML file. It also includes the 'execution' section for load generation. ```yaml services: - module: shellexec prepare: - mkdir tmp_guy - wget http://www.openss7.org/repos/csv_files/hosts.csv - sort -R hosts.csv > random_hosts.csv startup: - echo 1 > tmp_guy/bla.txt - echo 2 >> tmp_guy/bla.txt shutdown: - echo "shutdown time is $(date)" >> tmp/bla.txt post-process: - echo "this is a post process" >> tmp/bla.txt - mail -a tmp_guy/bzt.log -s “my_taurus_log_file” user@example.com < tmp/bla.txt execution: - concurrency: 20 hold-for: 60s iterations: 5 ramp-up: 10s scenario: Thread Group scenarios: Thread Group: data-sources: - delimiter: ',' path: random_hosts.csv quoted: false recycle: true requests: - label: HTTP Request method: GET url: http://www.blazedemo.com/ store-cache: false store-cookie: false use-dns-cache-mgr: false ``` -------------------------------- ### Configure JMeter Installation and Plugins Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/JMeter.md Configure JMeter path, version, and plugins for auto-installation. Specify plugin versions and manager details. ```yaml modules: jmeter: path: ~/.bzt/jmeter-taurus/bin/jmeter download-link: https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-{version}.zip version: 5.4.2 # minimal supported version of JMeter is 5.0 force-ctg: true # true by default detect-plugins: true fix-jars: true plugins: - jpgc-json=2.2 - jmeter-ftp - jpgc-casutg plugins-manager: download-link: https://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-manager/{version}/jmeter-plugins-manager-{version}.jar version: 1.3 # minimum 0.16 command-runner: download-link: https://search.maven.org/remotecontent?filepath=kg/apc/cmdrunner/{version}/cmdrunner-{version}.jar version: 2.2 # minimum 2.0 ``` -------------------------------- ### Manage Browser Windows with Apiritif Keywords Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Apiritif.md Use `openWindow`, `switchWindow`, and `closeWindow` keywords to manage browser windows. These actions require a value parameter specifying the window reference. ```python openWindow(value) ``` ```python switchWindow(value) ``` ```python closeWindow(value) ``` -------------------------------- ### Configure Virtual Display Service on Linux Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Selenium.md Enable headless test execution on Linux by configuring the virtual display service (Xvfb). Specify the desired screen resolution for the virtual display. ```yaml services: - module: virtual-display width: 1024 height: 768 ``` -------------------------------- ### JMeter Simple HTTP Authorization Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/JMeter.md Configure basic HTTP authorization with a URL, username, and password. This is the shortest form for quick setup. ```yaml scenarios: simply: authorization: url: auth_server_addr name: my_username password: my_pass ``` -------------------------------- ### Configure Selenium Load Steps Source: https://github.com/blazemeter/taurus/blob/master/site/dat/kb/SeleniumActions.md Define execution parameters such as concurrency, ramp-up, and hold duration for Selenium tests. This configuration is used with the `bzt` command to run the test. ```yaml execution: - executor: selenium scenario: open_page concurrency: 5 ramp-up: 2m hold-for: 5m scenarios: open_page: browser: Chrome timeout: 10s think-time: 3s default-address: http://blazedemo.com requests: - url: /purchase.php actions: - waitByCSS(h2): visible - keysByID(inputName): MyName - clickByCSS(.btn.btn-primary) assert: - contains: - 'Thank you for your purchase today!' ``` -------------------------------- ### Tsung Module Path and Command Line Options Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Tsung.md Configure the Tsung executor's path and command-line arguments. Use 'path' if Tsung is not in your system's PATH, and 'cmdline' to pass specific options to the Tsung executable. ```yaml modules: tsung: path: /usr/local/bin/tsung cmdline: -n ``` -------------------------------- ### JSR223 Post Processor (Inline Script) Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/JMeter.md Execute a Groovy script as a JSR223 Post-Processor after a request. This minimal example demonstrates setting a variable. ```yaml scenarios: jsr-example: requests: - url: http://blazedemo.com/ jsr223: 'vars.put("varname", "somevalue")' # inline script to execute, unless script-file is specified ``` -------------------------------- ### Load and display sample script Source: https://github.com/blazemeter/taurus/blob/master/site/dat/html/index.html This JavaScript code snippet, likely part of a web application, fetches a sample script based on user selection and displays it in a code area. It also updates a 'run it' button with the appropriate command. ```javascript $(document).ready(function () { $("#sample_chooser").find("li").click(function () { var fname = $(this).text(); $.get("/sample-scripts/" + fname).done(function (data) { $("#code_sample").html(data); $("#runit").text("bzt " + fname); }); }); $("#sample_chooser").find("li")[0].click(); }); ``` -------------------------------- ### Example Linter Output Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Linter.md This output shows common warnings generated by the Taurus linter, indicating potential typos or undefined elements in the configuration. ```text WARNING: at path 'execution.0.ramp': unfamiliar name 'ramp'. Did you mean 'ramp-up'? WARNING: at path 'execution.0.throuhhput': unfamiliar name 'throuhhput'. Did you mean 'throughput'? WARNING: at path 'execution.0.scenario': scenario 'foobar' is used but isn't defined ``` -------------------------------- ### Basic HTTP Request URL Configuration Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/JMeter.md Defines a simple HTTP request scenario using only the URL. Suitable for basic GET requests. ```yaml scenarios: get-requests: requests: - http://localhost/1 - http://localhost/2 ``` -------------------------------- ### Configure Local Monitoring Metrics Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Monitoring.md Enable and configure local resource monitoring by specifying the polling interval, logging, and desired metrics. Use '~' to select specific metrics. ```yaml services: - module: monitoring ~local: - interval: 20s # polling interval logging: True # local monitoring logs will be saved to "local_monitoring_logs.csv" in the artifacts dir metrics: - cpu - disk-space - engine-loop ``` -------------------------------- ### Customize Newman Tools Directory Source: https://github.com/blazemeter/taurus/blob/master/site/dat/docs/Postman.md Specify a custom directory for installing Newman and its npm dependencies. This is done using the `tools-dir` setting under the `newman` module configuration. ```yaml modules: newman: tools-dir: my-dir ```