Search code examples
postgresqljdbcjmeterassertions

Jmeter only logs only first failed assertion to .jtl file


Edit: Jmeter version: 3.1 r1770033

Im breaking my head on the following issue with Jmeter. I have tried several options including shifting around the order of the assertions. So far no result.

Functional wish

Basically I want the .jtl log file to reflect the content of the 'assertion result' view in the Jmeter Gui mode.

Current setup

I connect to a PostgreSQL database and execute a simple select from table query:

select * from progress_collaboration

This gives me the following resultset:

id  curr_env_id
999 1

On the sampler I have set 3 assertions:

  • Size Assertion
  • Response Assertion (string contains)
  • Duration Assertion

Problem

So far so good, up until only one assertion fails. When multiple assertions fail the 'assertion results' view shows me the following: assertionview image

However, the .jtl logfile (created by running the project from the commandline) only contains the first failed assertion.

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

How do I ensure the .jtl logfile contains ALL failed assertions?


Data

Hashtree with sampler and assertions:

        <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>
        

Solution

  • In jmeter.properties define/update propery:

    jmeter.save.saveservice.assertion_results=all

    (you probably have jmeter.save.saveservice.assertion_results=first defined)

    Also listener should have Save as XML check box checked (inside Configure)