testingjmeterload-testingtaurus

Jmeter + Taurus. How to set up thread group properties via property function


I am currently working on testing small API for our company, where we need to randomly spread number of calls to all methods of API. I am using Jmeter 5.3 and taurus.

Number of threads is generated via JSR223 sampler groovy script based on number specified in passed property file. Rampup period and loop count are specified by calling functions ${__P(rampup.period,)} ${__P(loop.count,)}

The problem is that when I am running jmeter standalone from command line all functions work correctly. But if I try to use taurus with that scenario all thread groups that acquire rampup period, loop count and thread count from properties are not working. It seems like jmeter cannot acquire properties via functions when run in taurus. Below are my scenario and property files. I have to omit some of the data from file which may be confidential

My taurus yml is:

execution:
  - executor: jmeter
    scenario: test

scenarios:
  test:
    script: *path to jmx file here*

included-configs:
- *path to yml property file here*

modules:
  jmeter:
    path: *path to existing jmeter executor here*

reporting:
- module: console
- module: final-stats
  summary: true  # overall samples count and percent of failures
  percentiles: true  # display average times and percentiles
  failed-labels: false  # provides list of sample labels with failures
  test-duration: true  # provides test duration

Part of my yml file with properties:

number.of.users: 10000
rampup.period: 300
loop.count: 1
client.id: *client id*
array.of.clients: [*array of ids*]
eks.ids: [1,2,3]

I am fairly new to taurus, jmeter and load testing in general. Am I doing something wrong (maybe I have to acquire properties or pass them some other way) or is it a bug of sorts? The only workaround I can think of now is put all properties via JSR sampler by using props.put and then executing something like ${__groovy(props.get('loop.count'),)} (for some reason in this version of jmeter you can access props that were put via script only in this manner)


Solution

  • Try the following:

    1. properties.yaml

      modules:
        jmeter:
          properties:
            my-number.of.users: 10
      
    2. test.yaml

      execution:
        - executor: jmeter
          scenario: test
      
      scenarios:
        test:
          script: test.jmx
      
      included-configs:
      - properties.yaml
      
      modules:
        jmeter:
          path: jmeter
      
    3. test.jmx

      <?xml version="1.0" encoding="UTF-8"?>
      <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.3">
        <hashTree>
          <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
            <stringProp name="TestPlan.comments"></stringProp>
            <boolProp name="TestPlan.functional_mode">false</boolProp>
            <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
            <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
            <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
              <collectionProp name="Arguments.arguments"/>
            </elementProp>
            <stringProp name="TestPlan.user_define_classpath"></stringProp>
          </TestPlan>
          <hashTree>
            <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
              <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
              <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
                <boolProp name="LoopController.continue_forever">false</boolProp>
                <stringProp name="LoopController.loops">1</stringProp>
              </elementProp>
              <stringProp name="ThreadGroup.num_threads">${__P(my-number.of.users,)}</stringProp>
              <stringProp name="ThreadGroup.ramp_time">1</stringProp>
              <boolProp name="ThreadGroup.scheduler">false</boolProp>
              <stringProp name="ThreadGroup.duration"></stringProp>
              <stringProp name="ThreadGroup.delay"></stringProp>
              <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
            </ThreadGroup>
            <hashTree>
              <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
                <boolProp name="displayJMeterProperties">false</boolProp>
                <boolProp name="displayJMeterVariables">true</boolProp>
                <boolProp name="displaySystemProperties">false</boolProp>
              </DebugSampler>
              <hashTree/>
            </hashTree>
          </hashTree>
        </hashTree>
      </jmeterTestPlan>
      

      Image version:

      enter image description here

      Textual representation of the number of threads:

      ${__P(my-number.of.users,)}
      

    Whenever you change 10 in the my-number.of.users: 10 line in properties.yaml the change will be reflected in the number of executed threads

    More information: