Jmeter灵活文件写入头问题

Jmeter灵活文件写入头问题,jmeter,Jmeter,但在CSV文件中,第一个反应是标题被打得乱七八糟,我在这里做错了什么 您确定打开的文件是正确的吗?我无法使用以下方法复制您的问题: 具有2个用户/循环 代码: 配置如下: 标题 endTimeMillis,responseTime,latency,sentBytes,receivedBytes,isSuccessful,responseCode,id,reqId 条目: endTimeMillis|,|responseTime|,|latency|,|sentBytes|,|recei

但在CSV文件中,第一个反应是标题被打得乱七八糟,我在这里做错了什么


您确定打开的文件是正确的吗?我无法使用以下方法复制您的问题:

  • 具有2个用户/循环

  • 代码:

  • 配置如下:

    • 标题

      endTimeMillis,responseTime,latency,sentBytes,receivedBytes,isSuccessful,responseCode,id,reqId
      
    • 条目:

      endTimeMillis|,|responseTime|,|latency|,|sentBytes|,|receivedBytes|,|isSuccessful|,|responseCode|,|variable#0|,|variable#1|\r\n
      
  • 演示:

    完整的测试计划,以防万一:

    <?xml version="1.0" encoding="UTF-8"?>
    <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1">
      <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">2</stringProp>
            </elementProp>
            <stringProp name="ThreadGroup.num_threads">2</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>
            <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Some Sampler" enabled="true">
              <stringProp name="cacheKey">true</stringProp>
              <stringProp name="filename"></stringProp>
              <stringProp name="parameters"></stringProp>
              <stringProp name="script">vars.put(&apos;id&apos;, &apos;KCO0000&apos;)
    vars.put(&apos;reqId&apos;, UUID.randomUUID().toString())</stringProp>
              <stringProp name="scriptLanguage">groovy</stringProp>
            </JSR223Sampler>
            <hashTree/>
            <kg.apc.jmeter.reporters.FlexibleFileWriter guiclass="kg.apc.jmeter.reporters.FlexibleFileWriterGui" testclass="kg.apc.jmeter.reporters.FlexibleFileWriter" testname="jp@gc - Flexible File Writer" enabled="true">
              <stringProp name="filename">testResults.txt</stringProp>
              <stringProp name="columns">endTimeMillis|,|responseTime|,|latency|,|sentBytes|,|receivedBytes|,|isSuccessful|,|responseCode|,|variable#0|,|variable#1|\r\n</stringProp>
              <boolProp name="overwrite">true</boolProp>
              <stringProp name="header">endTimeMillis,responseTime,latency,sentBytes,receivedBytes,isSuccessful,responseCode,id,reqId
    </stringProp>
              <stringProp name="footer"></stringProp>
            </kg.apc.jmeter.reporters.FlexibleFileWriter>
            <hashTree/>
          </hashTree>
        </hashTree>
      </hashTree>
    </jmeterTestPlan>
    
    
    假的
    真的
    假的
    持续
    假的
    2.
    2.
    1.
    假的
    真的
    真的
    可变存托凭证(&apos;id&apos;,&apos;KCO0000&apos;)
    vars.put(&apos;reqId&apos;,UUID.randomUUID().toString())
    棒极了
    testResults.txt
    endTimeMillis |,responseTime |,latency |,sentBytes |,receivedBytes |,isSuccessful |,responseCode |,variable#0 |,variable#1 | \r\n
    真的
    endTimeMillis,responseTime,latency,sentBytes,receivedBytes,isSuccessful,responseCode,id,reqId
    
    是的,我使用的是相同的配置,这可能是我使用ULTIMATE THREAD GROUP和JSON提取器的原因,当我删除头时,事情会正常运行
    <?xml version="1.0" encoding="UTF-8"?>
    <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1">
      <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">2</stringProp>
            </elementProp>
            <stringProp name="ThreadGroup.num_threads">2</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>
            <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Some Sampler" enabled="true">
              <stringProp name="cacheKey">true</stringProp>
              <stringProp name="filename"></stringProp>
              <stringProp name="parameters"></stringProp>
              <stringProp name="script">vars.put(&apos;id&apos;, &apos;KCO0000&apos;)
    vars.put(&apos;reqId&apos;, UUID.randomUUID().toString())</stringProp>
              <stringProp name="scriptLanguage">groovy</stringProp>
            </JSR223Sampler>
            <hashTree/>
            <kg.apc.jmeter.reporters.FlexibleFileWriter guiclass="kg.apc.jmeter.reporters.FlexibleFileWriterGui" testclass="kg.apc.jmeter.reporters.FlexibleFileWriter" testname="jp@gc - Flexible File Writer" enabled="true">
              <stringProp name="filename">testResults.txt</stringProp>
              <stringProp name="columns">endTimeMillis|,|responseTime|,|latency|,|sentBytes|,|receivedBytes|,|isSuccessful|,|responseCode|,|variable#0|,|variable#1|\r\n</stringProp>
              <boolProp name="overwrite">true</boolProp>
              <stringProp name="header">endTimeMillis,responseTime,latency,sentBytes,receivedBytes,isSuccessful,responseCode,id,reqId
    </stringProp>
              <stringProp name="footer"></stringProp>
            </kg.apc.jmeter.reporters.FlexibleFileWriter>
            <hashTree/>
          </hashTree>
        </hashTree>
      </hashTree>
    </jmeterTestPlan>