代码之家  ›  专栏  ›  技术社区  ›  Saagar

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

  •  0
  • Saagar  · 技术社区  · 6 年前

    如何在Jmeter中使用功能测试模式?它在哪里存储响应和采样器数据?

    enter image description here

    1 回复  |  直到 6 年前
        1
  •  1
  •   Dmitri T    6 年前

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


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

    1. 将以下行添加到 用户.属性

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

      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>
        
      • 如果 功能测试模式 将被勾选-所有内容都将存储在 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>