Jmeter只将第一个失败的断言记录到.jtl文件

时间:2017-07-05 11:49:20

标签: postgresql jdbc jmeter assertions

编辑:Jmeter版本:3.1 r1770033

我用Jmeter打破了以下问题。我尝试了几种选择,包括改变断言的顺序。到目前为止没有结果。

功能愿望

基本上我希望.jtl日志文件能够反映Jmeter Gui模式中“断言结果”视图的内容。

当前设置

我连接到PostgreSQL数据库并执行从表查询中的简单选择:

select * from progress_collaboration

这给了我以下结果集:

id  curr_env_id
999 1

在采样器上我设置了3个断言:

  • 尺寸断言
  • 响应断言(字符串包含)
  • 持续时间断言


问题

到目前为止一直很好,直到只有一个断言失败。当多个断言失败时,“断言结果”视图显示以下内容: assertionview image

但是,.jtl日志文件(通过从命令行运行项目创建)仅包含第一个失败的断言。

timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect
1499254721391,455,Check Beheer Variable,200,OK,Thread Group 1-1,text,false,"The result was the wrong size: It was 21 bytes, but should have been equal to 170 bytes.",21,0,1,1,453,0,443

如何确保.jtl日志文件包含所有失败的断言?


数据

带有采样器和断言的Hashtree:

        <JDBCSampler guiclass="TestBeanGUI" testclass="JDBCSampler" testname="Check Beheer Variable" enabled="true">
          <stringProp name="dataSource">myDatabase</stringProp>
          <stringProp name="query">select * from progress_collaboration</stringProp>
          <stringProp name="queryArguments"></stringProp>
          <stringProp name="queryArgumentsTypes"></stringProp>
          <stringProp name="queryTimeout"></stringProp>
          <stringProp name="queryType">Select Statement</stringProp>
          <stringProp name="resultSetHandler">Store as String</stringProp>
          <stringProp name="resultVariable"></stringProp>
          <stringProp name="variableNames"></stringProp>
        </JDBCSampler>
        <hashTree>
          <SizeAssertion guiclass="SizeAssertionGui" testclass="SizeAssertion" testname="Size Assertion" enabled="true">
            <stringProp name="Assertion.test_field">SizeAssertion.response_network_size</stringProp>
            <stringProp name="SizeAssertion.size">170</stringProp>
            <intProp name="SizeAssertion.operator">1</intProp>
          </SizeAssertion>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="56601">999</stringProp>
              <stringProp name="-715001365">incorrect_string</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">2</intProp>
          </ResponseAssertion>
          <hashTree/>
          <DurationAssertion guiclass="DurationAssertionGui" testclass="DurationAssertion" testname="Duration Assertion" enabled="true">
            <stringProp name="DurationAssertion.duration">1000</stringProp>
            <stringProp name="Assertion.scope">all</stringProp>
          </DurationAssertion>
          <hashTree/>
        </hashTree>

1 个答案:

答案 0 :(得分:1)

在jmeter.properties中定义/更新propery:

jmeter.save.saveservice.assertion_results =所有

(你可能有jmeter.save.saveservice.assertion_results =首次定义)

此外,侦听器应选中“另存为XML”复选框(在“配置”内)