jmeterperformance-testingjmeter-pluginsjmeter-5.0jmeter-logging

In Jmeter how to record/capture only error sampler data in raw JTL file through non gui mode?


When I'am running jmeter script in NON-GUI mode using the below command

jmeter -n -t test_plan.jmx -l logs.jtl

The jtl file generated does not contain any info like sampler request,response,headers etc. when viewed in view result tree. I want to record the request,response,headers,url etc. info in jtl file only for the failed samplers and not for the all samplers as recording for all samplers irrespective of fail or pass will make jtl file heavy. How can I record request,response,headers,url etc. info for only the failed samplers in the jtl file and view it in view result tree later using GUI mode? Thanks!!!


Solution

    1. You cannot have .jtl results file in both CSV and XML modes
    2. CSV mode doesn't contain response data by design

    So the options are in:

    1. Either amend JMeter's Results File Configuration and choose what do you want to store in XML format

    2. Or add a Listener like Simple Data Writer and configure it to save request and response data only for failed samplers like:

      enter image description here

    This way you will get

    More information: How to Save Response Data in JMeter