You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Ashuthosh Bhat <te...@googlemail.com.INVALID> on 2022/07/28 16:15:35 UTC

Capture HTTP Request and Response while running through CLI

Hi Team,

I need to capture http request and response while running load test in
command line mode at least for few runs with multiple users and threads.

I tried simple data writer but it didn't store any request, response in jtl
file.  I am looking for similar output as we get while running GUI.

Please suggest if its possible.

Thanks,
Ashuthosh

Re: Capture HTTP Request and Response while running through CLI

Posted by Dmitri T <gl...@live.com>.
As ofJMeter 5.5 <https://www.blazemeter.com/blog/jmeter-5-5> you cannot 
generate HTML Reporting Dashboard 
<https://jmeter.apache.org/usermanual/generating-dashboard.html> from 
the .jtl results file in XML format so you need to choose whether you 
want .jtl file to contain response data or to have ability to generate 
HTML reporting dashboard.


/The dashboard generator is a modular extension of JMeter. Its default 
behavior is to read and process samples *from CSV files* to generate 
HTML files containing graph views. It can generate the report at end of 
a load test or on demand. /

You can useSimple Data Writer 
<https://jmeter.apache.org/usermanual/component_reference.html#Simple_Data_Writer> 
listener to store request and response data in a *separate* file and 
keep the .jtl results file in CSV format if you need both.

Example configuration: https://i.stack.imgur.com/A21Gu.png



On 8/1/2022 3:33 AM, Ashuthosh Bhat wrote:
> Thanks Dimitri. Its giving following error from logs. Can you please take a
> look?
>
> 2022-08-01 01:28:08,097 ERROR o.a.j.JMeter: Error in NonGUIDriver
> java.lang.IllegalArgumentException: Report generation requires csv output
> format, check 'jmeter.save.saveservice.output_format' property
>
> I have set user.properties in current directory and in jmeter/bin with the
> values specified in the mail trial by you. Following are the commands used
> to execute the script
>
> jmeter -n -t script-name-28072022-1X1.jmx -l reports/0108/
> script-name-28072022-1X1.*xml *-e -o reports/0108/ script-name-28072022-1X1
> -j reports/0108/ script-name-28072022-1X1.log
> jmeter -n -t script-name-28072022-1X1.jmx -l
> reports/0108/ script-name-28072022-1X1.*jtl* -e -o
> reports/0108/ script-name-28072022-1X1 -j
> reports/0108/ script-name-28072022-1X1.log
>
> Warm Regards,
> Ashu
>
> On Fri, Jul 29, 2022 at 12:16 PM Dmitri T<gl...@live.com>  wrote:
>
>> Simple Data Writer doesn't store anything into .jtl file, you need to
>> provide the desired path to the file via "Write results to file" input
>> and the metrics you choose in the pop-up which appears when you click
>> "Configure" button will be stored into this *separate* file.
>>
>> In order to have request and response data in the .jtl results file you
>> need to manipulate the relevant JMeter Properties
>> < 
>> https://jmeter.apache.org/usermanual/properties_reference.html#results_file_config>,
>>
>> i.e. add the next lines to /user.properties/ file
>> <https://jmeter.apache.org/usermanual/get-started.html#configuring_jmeter
>>> :
>> jmeter.save.saveservice.output_format=xml
>> jmeter.save.saveservice.response_data=true
>> jmeter.save.saveservice.samplerData=true
>> jmeter.save.saveservice.requestHeaders=true
>> jmeter.save.saveservice.responseHeaders=true
>> jmeter.save.saveservice.url=true
>>
>> more information: How to Save Response Data in JMeter
>> <https://www.blazemeter.com/blog/response-data-in-jmeter>
>>
>>
>> On 7/28/2022 6:15 PM, Ashuthosh Bhat wrote:
>>> Hi Team,
>>>
>>> I need to capture http request and response while running load test in
>>> command line mode at least for few runs with multiple users and threads.
>>>
>>> I tried simple data writer but it didn't store any request, response in
>> jtl
>>> file.  I am looking for similar output as we get while running GUI.
>>>
>>> Please suggest if its possible.
>>>
>>> Thanks,
>>> Ashuthosh
>>>

Re: Capture HTTP Request and Response while running through CLI

Posted by Ashuthosh Bhat <te...@googlemail.com.INVALID>.
Thanks Dimitri. Its giving following error from logs. Can you please take a
look?

2022-08-01 01:28:08,097 ERROR o.a.j.JMeter: Error in NonGUIDriver
java.lang.IllegalArgumentException: Report generation requires csv output
format, check 'jmeter.save.saveservice.output_format' property

I have set user.properties in current directory and in jmeter/bin with the
values specified in the mail trial by you. Following are the commands used
to execute the script

jmeter -n -t script-name-28072022-1X1.jmx -l reports/0108/
script-name-28072022-1X1.*xml *-e -o reports/0108/ script-name-28072022-1X1
-j reports/0108/ script-name-28072022-1X1.log
jmeter -n -t script-name-28072022-1X1.jmx -l
reports/0108/ script-name-28072022-1X1.*jtl* -e -o
reports/0108/ script-name-28072022-1X1 -j
reports/0108/ script-name-28072022-1X1.log

Warm Regards,
Ashu

On Fri, Jul 29, 2022 at 12:16 PM Dmitri T <gl...@live.com> wrote:

> Simple Data Writer doesn't store anything into .jtl file, you need to
> provide the desired path to the file via "Write results to file" input
> and the metrics you choose in the pop-up which appears when you click
> "Configure" button will be stored into this *separate* file.
>
> In order to have request and response data in the .jtl results file you
> need to manipulate the relevant JMeter Properties
> <
> https://jmeter.apache.org/usermanual/properties_reference.html#results_file_config>,
>
> i.e. add the next lines to /user.properties/ file
> <https://jmeter.apache.org/usermanual/get-started.html#configuring_jmeter
> >:
>
> jmeter.save.saveservice.output_format=xml
> jmeter.save.saveservice.response_data=true
> jmeter.save.saveservice.samplerData=true
> jmeter.save.saveservice.requestHeaders=true
> jmeter.save.saveservice.responseHeaders=true
> jmeter.save.saveservice.url=true
>
> more information: How to Save Response Data in JMeter
> <https://www.blazemeter.com/blog/response-data-in-jmeter>
>
>
> On 7/28/2022 6:15 PM, Ashuthosh Bhat wrote:
> > Hi Team,
> >
> > I need to capture http request and response while running load test in
> > command line mode at least for few runs with multiple users and threads.
> >
> > I tried simple data writer but it didn't store any request, response in
> jtl
> > file.  I am looking for similar output as we get while running GUI.
> >
> > Please suggest if its possible.
> >
> > Thanks,
> > Ashuthosh
> >

Re: Capture HTTP Request and Response while running through CLI

Posted by Dmitri T <gl...@live.com>.
Simple Data Writer doesn't store anything into .jtl file, you need to 
provide the desired path to the file via "Write results to file" input 
and the metrics you choose in the pop-up which appears when you click 
"Configure" button will be stored into this *separate* file.

In order to have request and response data in the .jtl results file you 
need to manipulate the relevant JMeter Properties 
<https://jmeter.apache.org/usermanual/properties_reference.html#results_file_config>, 
i.e. add the next lines to /user.properties/ file 
<https://jmeter.apache.org/usermanual/get-started.html#configuring_jmeter>:

jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.responseHeaders=true
jmeter.save.saveservice.url=true

more information: How to Save Response Data in JMeter 
<https://www.blazemeter.com/blog/response-data-in-jmeter>


On 7/28/2022 6:15 PM, Ashuthosh Bhat wrote:
> Hi Team,
>
> I need to capture http request and response while running load test in
> command line mode at least for few runs with multiple users and threads.
>
> I tried simple data writer but it didn't store any request, response in jtl
> file.  I am looking for similar output as we get while running GUI.
>
> Please suggest if its possible.
>
> Thanks,
> Ashuthosh
>