merge config, or include files

60 views
Skip to first unread message

Aaron Meade

unread,
Apr 22, 2022, 4:11:55 PM4/22/22
to BlazeMeter Forum
How can I include variable data from one yaml file in another yaml file?  I have seen several examples but none have worked.  I am running my test starting with a yaml file inside of Blazemeter, and the requests are in several jmx files.  If I include all of my variable data in the main yaml file, it works fine.  If I try to split any of it out into a second yaml file to be merged in at runtime, it does not work.  I feel like this should be possible.

Aaron Meade

unread,
Apr 22, 2022, 4:32:13 PM4/22/22
to BlazeMeter Forum
Main yaml file, set as the starting file in Blazemeter.  This file contains the DEFAULT values to be overwritten at runtime:
--------------------------------
execution:
  iterations: 10
  concurrency: 1
  scenario: my-scenario
 
scenarios:
   my-scenario:
      variables:
         var1: DEFAULT1
         var2: DEFAULT2
     script: my-test.jmx
----------------------------------

Second yaml file containing the actual values to use at runtime:
-------------------------------
scenarios:
    my-scenario:
          variables:
               var1: liveData1
               var2: liveData2


The reason for this is that the first file will be kept in source control and retrieved to Blazemeter via Jenkins, while the second file will only ever live in Blazemeter and will not be under source control.

Dmitri T

unread,
Apr 23, 2022, 2:15:04 AM4/23/22
to BlazeMeter Forum
It seems that included-configs should do the trick for you.

Additional YAML:

modules:
  jmeter:
    properties:
      var1 : liveData1
      var2: liveData2

Main YAML:

included-configs:  
- second.yml

In JMeter or Taurus the properties can be referenced as ${__P(var1,)}

More information:

Aaron Meade

unread,
Apr 26, 2022, 9:31:39 AM4/26/22
to BlazeMeter Forum
Thanks, that makes sense but it is not working.  I have tried:

included.yaml:

modules:
     jmeter:
          properties:
               val1: this_is_the_val_to_use_at_runtime

main.yaml:

included-config:
- included.yaml

execution:
     scenario: my-test
     iterations: 10
     concurrency: 1

scenarios:
     my-test:
          variables:
               var1: ${__P(val1)}
script: myscript.jmx

the only way I have been able to get it to work so far is by defining the val1 property in main.yaml, which defeats the purpose of moving it to an included file.  I still feel like this should be possible, and I am missing something fundamental here...

Aaron Meade

unread,
Apr 26, 2022, 9:42:54 AM4/26/22
to BlazeMeter Forum
It should be said that I am running main.yaml as my beginning file in Blazemeter, and the other files are present in the test configuration.  

Aaron Meade

unread,
Apr 27, 2022, 10:42:43 AM4/27/22
to BlazeMeter Forum
one last bump before I start looking for a different solution... any idea what I need to change in the following in order to pull the property value from the included.yaml file? 

included.yaml:

modules:
     jmeter:
          properties:
               val1: this_is_the_val_to_use_at_runtime

main.yaml:

included-config:
- included.yaml

execution:
     scenario: my-test
     iterations: 10
     concurrency: 1

scenarios:
     my-test:
          variables:
               var1: ${__P(val1)}
script: myscript.jmx

Aaron Meade

unread,
Apr 27, 2022, 12:35:37 PM4/27/22
to BlazeMeter Forum
After much searching and trial and error testing, it seems that JMeter property values cannot be retrieved this way from an included configuration. 

Dmitri T

unread,
Apr 29, 2022, 12:55:42 AM4/29/22
to BlazeMeter Forum
Then try searching once again

Here is an example solution:

  •     properties.yaml file:

modules:
  jmeter:
    properties:
      my-number.of.users: 10

  •     taurus YAML file:

execution:
  - executor: jmeter
    scenario: test

scenarios:
  test:
    script: test.jmx

included-configs:
- properties.yaml

modules:
  jmeter:
    path: jmeter

  •     JMeter script:

<?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>

References:

Reply all
Reply to author
Forward
0 new messages