Jmeter-测试计划功能测试模式

Jmeter- Test plan Functional test mode

我尝试在 Jmeter 中使用功能测试模式。但是找不到任何区别。 如何在 Jmeter 中使用功能测试模式?它在哪里存储 Response 和 Sampler 数据?

如果您 运行 使用 JMeter GUI 进行测试 - 无处可去。结果保存在内存中,可以使用 View Results Tree listener

可视化

根据 documentation,您只会在以下情况下看到差异:

  1. 您将以下行添加到 user.properties

    jmeter.save.saveservice.output_format=xml
    
  2. 运行 JMeter 在命令行非 GUI 模式下,如:

    jmeter -n -t test.jmx -l result.xml
    
    • 如果取消勾选 Functional Test Mode - 只有基本信息将存储在 result.xml 文件中(根据 results file configuration 中指定的内容 - 参见 ),即

      <?xml version="1.0" encoding="UTF-8"?>
      <testResults version="1.2">
      <httpSample t="298" it="0" lt="297" ct="54" ts="1540368444288" s="true" lb="HTTP Request" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="1597" sby="115" ng="1" na="1">
        <java.net.URL>http://example.com/</java.net.URL>
      </httpSample>
      
      </testResults>
      
    • 如果勾选 Functional Test Mode - 所有内容都将存储在 results.xml 文件中,包括请求和响应的详细信息:

      <?xml version="1.0" encoding="UTF-8"?>
      <testResults version="1.2">
      <httpSample t="176" it="0" lt="176" ct="43" ts="1540368457253" s="true" lb="HTTP Request" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="1613" sby="115" ng="1" na="1">
        <responseData class="java.lang.String">&lt;!doctype html&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Example Domain&lt;/title&gt;
      
          &lt;meta charset=&quot;utf-8&quot; /&gt;
          &lt;meta http-equiv=&quot;Content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
          &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;
          &lt;style type=&quot;text/css&quot;&gt;
          body {
              background-color: #f0f0f2;
              margin: 0;
              padding: 0;
              font-family: &quot;Open Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;
      
          }
          div {
              width: 600px;
              margin: 5em auto;
              padding: 50px;
              background-color: #fff;
              border-radius: 1em;
          }
          a:link, a:visited {
              color: #38488f;
              text-decoration: none;
          }
          @media (max-width: 700px) {
              body {
                  background-color: #fff;
              }
              div {
                  width: auto;
                  margin: 0 auto;
                  border-radius: 0;
                  padding: 1em;
              }
          }
          &lt;/style&gt;    
      &lt;/head&gt;
      
      &lt;body&gt;
      &lt;div&gt;
          &lt;h1&gt;Example Domain&lt;/h1&gt;
          &lt;p&gt;This domain is established to be used for illustrative examples in documents. You may use this
          domain in examples without prior coordination or asking for permission.&lt;/p&gt;
          &lt;p&gt;&lt;a href=&quot;http://www.iana.org/domains/example&quot;&gt;More information...&lt;/a&gt;&lt;/p&gt;
      &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
      </responseData>
        <cookies class="java.lang.String"></cookies>
        <method class="java.lang.String">GET</method>
        <queryString class="java.lang.String"></queryString>
        <java.net.URL>http://example.com/</java.net.URL>
      </httpSample>
      
      </testResults>
      

更多信息: