Create jmx file with code

I want to do distributed testing in jmeter, for which we need a jmx file. I want to write code that will create a jmx file without using jmeter libraries and populate the values. can someone help me?

+4
source share
1 answer

You may know that the jmx file is an xml file type and has a node structure on node. Using any XML apis jmx files can be created programmatically. My suggestion is to create a complete test plan in jmeter with all the basic test elements, such as Samplers, Listeners, Pre and Post, and save the jmx file, and then collect new XML files based on this jmx structure as follows

<jmeterTestPlan version="1.2" properties="2.4" jmeter="2.9">
  <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.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>
      <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor" enabled="true">
        <stringProp name="RegexExtractor.useHeaders">false</stringProp>
        <stringProp name="RegexExtractor.refname">REF</stringProp>
        <stringProp name="RegexExtractor.regex">(.*)</stringProp>
        <stringProp name="RegexExtractor.template">$1$</stringProp>
      </RegexExtractor>
    </hashTree>


  </hashTree>

</jmeterTestPlan>

API javax.xml XML (. ), . , , - -, . #.

.

+3

Source: https://habr.com/ru/post/1530168/


All Articles