我使用JMeter的命令行强调测试我们的网站的API。现在,这里是一个样本结果我恢复:

Creating summariser <summary>
Created the tree successfully using street_advisor.jmx
Starting the test @ Sat Oct 03 15:22:59 PDT 2009 (1254608579848)
Waiting for possible shutdown message on port 4445
summary +     1 in   0.0s =   37.0/s Avg:    27 Min:    27 Max:    27 Err:     1 (100.00%)
<snip a few more lines>
<then i break it>

,所以我得到一个错误。

目前,所有的错误都去到一个文件中。当我检查该文件,它说这是一个404呃...好吧。反正是有,我可以看到的究竟的什么请求JMeter的尝试?

这是我的配置文件中的一个片段:

<ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="Error Writer" enabled="true">
          <boolProp name="ResultCollector.error_logging">true</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>false</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>false</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>true</xml>
              <fieldNames>false</fieldNames>
              <responseHeaders>true</responseHeaders>
              <requestHeaders>true</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
            </value>
          </objProp>
          <stringProp name="filename">./error.jtl</stringProp>
        </ResultCollector>

现在,有人说“之前检查Web服务器日志文件”,我知道我能做到这一点,是的,我已经找到了404 ..但我希望能看到,如果有可能,而无需访问他们..特别是如果他们是另一台服务器上和/或我不能访问到它们。 请帮助!

有帮助吗?

解决方案

查看结果树 组件示出了所有样品的反应的树,让您同时查看请求和响应任何样品。

当负载测试(始终在NON GUI模式),填写 “文件名” 字段,并选择仅保存在错误响应:

正如你可以在上面看到,我们点击Configure选择,除了那些CSV各个领域。

您还可以使用响应保存到文件

其他提示

我发现这个线程搜索记录响应的解决方案的当取样失败,所以接受的解决方案是对我不好。我有一个非常高的负荷,涉及数以十万计的样本偶尔样品失效,所以树听众对我来说是完全不切实际(将达到大小为几个千兆字节),所以这里是我想出了(这应该是好的的OP的情况下也一样):

添加[JSR223 Assertion][1](应该来的所有其他断言之后),并把下面的代码在它:

if (Boolean.valueOf(vars.get("DEBUG"))) {
  for (a: SampleResult.getAssertionResults()) {
    if (a.isError() || a.isFailure()) {
      log.error(Thread.currentThread().getName()+": "+SampleLabel+": Assertion failed for response: " + new String((byte[]) ResponseData));
    }
  }
}

这将导致整个应对越来越记录到这是在我的情况很好,因为我知道,反应是非常小的JMeter的日志文件,但对于大的反应,可以做更多的智能处理。

有一个“保存的响应到文件”侦听,这可以节省发生错误时只文件。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top