Skip to content

Instantly share code, notes, and snippets.

@vlsi
Last active March 7, 2018 06:12
Show Gist options
  • Save vlsi/0975c5e7be6f469f802921a38c005489 to your computer and use it in GitHub Desktop.
Save vlsi/0975c5e7be6f469f802921a38c005489 to your computer and use it in GitHub Desktop.
JMeter suggestion: add comment that briefly describes test plan as an XML comment

Current JMeter's JMX files are not human-readable, and it is hard to review "diff" between two versions of a script.

I suggest adding a human-readable comment to the start of the file, so the diff between scripts can be easier to understand:

<?xml version="1.0" encoding="UTF-8"?>
<!--
Test plan:
   Thread group (146 threads, 1:00:00 duration)
      login (http sampler /login)
      Test Loop (Loop Controller)
        navigate to desktop (http sampler /desktop)
          extract regex /...../
          ...
          
^^^ note that above is just a human-friendly comment, it is not supposed to be parsed by JMeter and/or changed by humans.
-->
<jmeterTestPlan version="1.2" properties="2.8" jmeter="2.13 r1665067">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Sandbox">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="abcd" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Main Thread group">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <stringProp name="ThreadGroup.num_threads">146</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1432277428717</longProp>
        <longProp name="ThreadGroup.end_time">1432243457000</longProp>
        <boolProp name="ThreadGroup.scheduler">true</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="internalName">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">42</stringProp>
        </elementProp>
      </ThreadGroup>
      <hashTree>
        <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller">
          <boolProp name="LoopController.continue_forever">true</boolProp>
          <stringProp name="LoopController.loops">34</stringProp>
        </LoopController>
        <hashTree>
          <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="test">
            <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments">
              <collectionProp name="Arguments.arguments">
                <elementProp name="abcd" elementType="HTTPArgument" testclass="HTTPArgument">
                  <stringProp name="Argument.name">abcd</stringProp>
                </elementProp>
                <elementProp name="&lt;no elementName&gt;" elementType="HTTPArgument" testclass="HTTPArgument">
                  <stringProp name="Argument.name">&lt;no elementName&gt;</stringProp>
                </elementProp>
                <elementProp name="&lt;no elementName&gt;" elementType="HTTPArgument" testclass="HTTPArgument">
@StephanPilon
Copy link

StephanPilon commented Jul 27, 2017

I was searching for a way to add a text document to a Thread Group or, at least, to a Test Plan and I found this.
Great suggestion. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment